<!DOCTYPE html>
<html>
  <head>
      <meta charset="UTF-8">
      <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=no, minimal-ui">
      <meta name="screen-orientation" content="portrait"/>
      <meta name="apple-mobile-web-app-capable" content="yes">
      <meta name="format-detection" content="telephone=no">
      <meta name="full-screen" content="yes">
      <meta name="x5-fullscreen" content="true">
    <title>vue</title>
    <script>
        !function(A,e){A.Long=e()}(this,function(){"use strict";function A(A,e,i){this.low=0|A,this.high=0|e,this.unsigned=!!i}function e(A){return(A&&A.__isLong__)===!0}function i(A,e){var i,o,n;return e?(A>>>=0,(n=0<=A&&A<256)&&(o=E[A])?o:(i=g(A,(0|A)<0?-1:0,!0),n&&(E[A]=i),i)):(A|=0,(n=-128<=A&&A<128)&&(o=C[A])?o:(i=g(A,A<0?-1:0,!1),n&&(C[A]=i),i))}function o(A,e){if(isNaN(A)||!isFinite(A))return e?D:f;if(e){if(A<0)return D;if(A>=B)return h}else{if(A<=-w)return G;if(A+1>=w)return u}return A<0?o(-A,e).neg():g(A%r|0,A/r|0,e)}function g(e,i,o){return new A(e,i,o)}function n(A,e,i){if(0===A.length)throw Error("empty string");if("NaN"===A||"Infinity"===A||"+Infinity"===A||"-Infinity"===A)return f;if("number"==typeof e?(i=e,e=!1):e=!!e,i=i||10,i<2||36<i)throw RangeError("radix");var g;if((g=A.indexOf("-"))>0)throw Error("interior hyphen");if(0===g)return n(A.substring(1),e,i).neg();for(var t=o(I(i,8)),C=f,E=0;E<A.length;E+=8){var s=Math.min(8,A.length-E),Q=parseInt(A.substring(E,E+s),i);if(s<8){var r=o(I(i,s));C=C.mul(r).add(o(Q))}else C=C.mul(t),C=C.add(o(Q))}return C.unsigned=e,C}function t(e){return e instanceof A?e:"number"==typeof e?o(e):"string"==typeof e?n(e):g(e.low,e.high,e.unsigned)}A.prototype.__isLong__,Object.defineProperty(A.prototype,"__isLong__",{value:!0,enumerable:!1,configurable:!1}),A.isLong=e;var C={},E={};A.fromInt=i,A.fromNumber=o,A.fromBits=g;var I=Math.pow;A.fromString=n,A.fromValue=t;var s=65536,Q=1<<24,r=s*s,B=r*r,w=B/2,M=i(Q),f=i(0);A.ZERO=f;var D=i(0,!0);A.UZERO=D;var a=i(1);A.ONE=a;var c=i(1,!0);A.UONE=c;var P=i(-1);A.NEG_ONE=P;var u=g(-1,2147483647,!1);A.MAX_VALUE=u;var h=g(-1,-1,!0);A.MAX_UNSIGNED_VALUE=h;var G=g(0,-2147483648,!1);A.MIN_VALUE=G;var l=A.prototype;return l.toInt=function(){return this.unsigned?this.low>>>0:this.low},l.toNumber=function(){return this.unsigned?(this.high>>>0)*r+(this.low>>>0):this.high*r+(this.low>>>0)},l.toString=function(A){if(A=A||10,A<2||36<A)throw RangeError("radix");if(this.isZero())return"0";if(this.isNegative()){if(this.eq(G)){var e=o(A),i=this.div(e),g=i.mul(e).sub(this);return i.toString(A)+g.toInt().toString(A)}return"-"+this.neg().toString(A)}for(var n=o(I(A,6),this.unsigned),t=this,C="";;){var E=t.div(n),s=t.sub(E.mul(n)).toInt()>>>0,Q=s.toString(A);if(t=E,t.isZero())return Q+C;for(;Q.length<6;)Q="0"+Q;C=""+Q+C}},l.getHighBits=function(){return this.high},l.getHighBitsUnsigned=function(){return this.high>>>0},l.getLowBits=function(){return this.low},l.getLowBitsUnsigned=function(){return this.low>>>0},l.getNumBitsAbs=function(){if(this.isNegative())return this.eq(G)?64:this.neg().getNumBitsAbs();for(var A=0!=this.high?this.high:this.low,e=31;e>0&&0==(A&1<<e);e--);return 0!=this.high?e+33:e+1},l.isZero=function(){return 0===this.high&&0===this.low},l.isNegative=function(){return!this.unsigned&&this.high<0},l.isPositive=function(){return this.unsigned||this.high>=0},l.isOdd=function(){return 1===(1&this.low)},l.isEven=function(){return 0===(1&this.low)},l.equals=function(A){return e(A)||(A=t(A)),(this.unsigned===A.unsigned||this.high>>>31!==1||A.high>>>31!==1)&&(this.high===A.high&&this.low===A.low)},l.eq=l.equals,l.notEquals=function(A){return!this.eq(A)},l.neq=l.notEquals,l.lessThan=function(A){return this.comp(A)<0},l.lt=l.lessThan,l.lessThanOrEqual=function(A){return this.comp(A)<=0},l.lte=l.lessThanOrEqual,l.greaterThan=function(A){return this.comp(A)>0},l.gt=l.greaterThan,l.greaterThanOrEqual=function(A){return this.comp(A)>=0},l.gte=l.greaterThanOrEqual,l.compare=function(A){if(e(A)||(A=t(A)),this.eq(A))return 0;var i=this.isNegative(),o=A.isNegative();return i&&!o?-1:!i&&o?1:this.unsigned?A.high>>>0>this.high>>>0||A.high===this.high&&A.low>>>0>this.low>>>0?-1:1:this.sub(A).isNegative()?-1:1},l.comp=l.compare,l.negate=function(){return!this.unsigned&&this.eq(G)?G:this.not().add(a)},l.neg=l.negate,l.add=function(A){e(A)||(A=t(A));var i=this.high>>>16,o=65535&this.high,n=this.low>>>16,C=65535&this.low,E=A.high>>>16,I=65535&A.high,s=A.low>>>16,Q=65535&A.low,r=0,B=0,w=0,M=0;return M+=C+Q,w+=M>>>16,M&=65535,w+=n+s,B+=w>>>16,w&=65535,B+=o+I,r+=B>>>16,B&=65535,r+=i+E,r&=65535,g(w<<16|M,r<<16|B,this.unsigned)},l.subtract=function(A){return e(A)||(A=t(A)),this.add(A.neg())},l.sub=l.subtract,l.multiply=function(A){if(this.isZero())return f;if(e(A)||(A=t(A)),A.isZero())return f;if(this.eq(G))return A.isOdd()?G:f;if(A.eq(G))return this.isOdd()?G:f;if(this.isNegative())return A.isNegative()?this.neg().mul(A.neg()):this.neg().mul(A).neg();if(A.isNegative())return this.mul(A.neg()).neg();if(this.lt(M)&&A.lt(M))return o(this.toNumber()*A.toNumber(),this.unsigned);var i=this.high>>>16,n=65535&this.high,C=this.low>>>16,E=65535&this.low,I=A.high>>>16,s=65535&A.high,Q=A.low>>>16,r=65535&A.low,B=0,w=0,D=0,a=0;return a+=E*r,D+=a>>>16,a&=65535,D+=C*r,w+=D>>>16,D&=65535,D+=E*Q,w+=D>>>16,D&=65535,w+=n*r,B+=w>>>16,w&=65535,w+=C*Q,B+=w>>>16,w&=65535,w+=E*s,B+=w>>>16,w&=65535,B+=i*r+n*Q+C*s+E*I,B&=65535,g(D<<16|a,B<<16|w,this.unsigned)},l.mul=l.multiply,l.divide=function(A){if(e(A)||(A=t(A)),A.isZero())throw Error("division by zero");if(this.isZero())return this.unsigned?D:f;var i,g,n;if(this.unsigned){if(A.unsigned||(A=A.toUnsigned()),A.gt(this))return D;if(A.gt(this.shru(1)))return c;n=D}else{if(this.eq(G)){if(A.eq(a)||A.eq(P))return G;if(A.eq(G))return a;var C=this.shr(1);return i=C.div(A).shl(1),i.eq(f)?A.isNegative()?a:P:(g=this.sub(A.mul(i)),n=i.add(g.div(A)))}if(A.eq(G))return this.unsigned?D:f;if(this.isNegative())return A.isNegative()?this.neg().div(A.neg()):this.neg().div(A).neg();if(A.isNegative())return this.div(A.neg()).neg();n=f}for(g=this;g.gte(A);){i=Math.max(1,Math.floor(g.toNumber()/A.toNumber()));for(var E=Math.ceil(Math.log(i)/Math.LN2),s=E<=48?1:I(2,E-48),Q=o(i),r=Q.mul(A);r.isNegative()||r.gt(g);)i-=s,Q=o(i,this.unsigned),r=Q.mul(A);Q.isZero()&&(Q=a),n=n.add(Q),g=g.sub(r)}return n},l.div=l.divide,l.modulo=function(A){return e(A)||(A=t(A)),this.sub(this.div(A).mul(A))},l.mod=l.modulo,l.not=function(){return g(~this.low,~this.high,this.unsigned)},l.and=function(A){return e(A)||(A=t(A)),g(this.low&A.low,this.high&A.high,this.unsigned)},l.or=function(A){return e(A)||(A=t(A)),g(this.low|A.low,this.high|A.high,this.unsigned)},l.xor=function(A){return e(A)||(A=t(A)),g(this.low^A.low,this.high^A.high,this.unsigned)},l.shiftLeft=function(A){return e(A)&&(A=A.toInt()),0===(A&=63)?this:A<32?g(this.low<<A,this.high<<A|this.low>>>32-A,this.unsigned):g(0,this.low<<A-32,this.unsigned)},l.shl=l.shiftLeft,l.shiftRight=function(A){return e(A)&&(A=A.toInt()),0===(A&=63)?this:A<32?g(this.low>>>A|this.high<<32-A,this.high>>A,this.unsigned):g(this.high>>A-32,this.high>=0?0:-1,this.unsigned)},l.shr=l.shiftRight,l.shiftRightUnsigned=function(A){if(e(A)&&(A=A.toInt()),A&=63,0===A)return this;var i=this.high;if(A<32){var o=this.low;return g(o>>>A|i<<32-A,i>>>A,this.unsigned)}return 32===A?g(i,0,this.unsigned):g(i>>>A-32,0,this.unsigned)},l.shru=l.shiftRightUnsigned,l.toSigned=function(){return this.unsigned?g(this.low,this.high,!1):this},l.toUnsigned=function(){return this.unsigned?this:g(this.low,this.high,!0)},l.toBytes=function(A){return A?this.toBytesLE():this.toBytesBE()},l.toBytesLE=function(){var A=this.high,e=this.low;return[255&e,e>>>8&255,e>>>16&255,e>>>24&255,255&A,A>>>8&255,A>>>16&255,A>>>24&255]},l.toBytesBE=function(){var A=this.high,e=this.low;return[A>>>24&255,A>>>16&255,A>>>8&255,255&A,e>>>24&255,e>>>16&255,e>>>8&255,255&e]},A});var webim={login:function(A,e,i){},syncMsgs:function(A,e){},getC2CHistoryMsgs:function(A,e,i){},syncGroupMsgs:function(A,e,i){},sendMsg:function(A,e,i){},logout:function(A,e){},setAutoRead:function(A,e,i){},getProfilePortrait:function(A,e,i){},setProfilePortrait:function(A,e,i){},applyAddFriend:function(A,e,i){},getPendency:function(A,e,i){},deletePendency:function(A,e,i){},responseFriend:function(A,e,i){},getAllFriend:function(A,e,i){},deleteFriend:function(A,e,i){},addBlackList:function(A,e,i){},getBlackList:function(A,e,i){},deleteBlackList:function(A,e,i){},uploadPic:function(A,e,i){},createGroup:function(A,e,i){},applyJoinGroup:function(A,e,i){},handleApplyJoinGroup:function(A,e,i){},deleteApplyJoinGroupPendency:function(A,e,i){},quitGroup:function(A,e,i){},getGroupPublicInfo:function(A,e,i){},getGroupInfo:function(A,e,i){},modifyGroupBaseInfo:function(A,e,i){},destroyGroup:function(A,e,i){},getJoinedGroupListHigh:function(A,e,i){},getGroupMemberInfo:function(A,e,i){},addGroupMember:function(A,e,i){},modifyGroupMember:function(A,e,i){},forbidSendMsg:function(A,e,i){},deleteGroupMember:function(A,e,i){},getPendencyGroup:function(A,e,i){},getPendencyReport:function(A,e,i){},getPendencyGroupRead:function(A,e,i){},sendCustomGroupNotify:function(A,e,i){},Msg:function(A,e,i,o,g,n,t,C){},MsgStore:{sessMap:function(){return{}},sessCount:function(){return 0},sessByTypeId:function(A,e){return{}},delSessByTypeId:function(A,e){return!0},resetCookieAndSyncFlag:function(){},downloadMap:{}}};!function(A){var e={VERSION:"1.7.0",APPID:"537048168",PLAATFORM:"10"},i=!0,o={FORMAL:{COMMON:"https://webim.tim.qq.com",PIC:"https://pic.tim.qq.com"},TEST:{COMMON:"https://test.tim.qq.com",PIC:"https://pic.tim.qq.com"}},g={},n=!1,t={OPEN_IM:"openim",GROUP:"group_open_http_svc",FRIEND:"sns",PROFILE:"profile",RECENT_CONTACT:"recentcontact",PIC:"openpic",BIG_GROUP:"group_open_http_noauth_svc",BIG_GROUP_LONG_POLLING:"group_open_long_polling_http_noauth_svc",IM_OPEN_STAT:"imopenstat",DEL_CHAT:"recentcontact"},C={openim:"v4",group_open_http_svc:"v4",sns:"v4",profile:"v4",recentcontact:"v4",openpic:"v4",group_open_http_noauth_svc:"v1",group_open_long_polling_http_noauth_svc:"v1",imopenstat:"v4",recentcontact:"v4"},E={login:1,pic_up:3,apply_join_group:9,create_group:10,longpolling:18,send_group_msg:19,sendmsg:20},I={C2C:"C2C",GROUP:"GROUP"},s={C2C:1,GROUP:2},Q={C2C:12e3,GROUP:8898},r={OK:"OK",FAIL:"FAIL"},B=99999,w={TEXT:"TIMTextElem",FACE:"TIMFaceElem",IMAGE:"TIMImageElem",CUSTOM:"TIMCustomElem",SOUND:"TIMSoundElem",FILE:"TIMFileElem",LOCATION:"TIMLocationElem",GROUP_TIP:"TIMGroupTipElem"},M={ORIGIN:1,LARGE:2,SMALL:3},f={JPG:1,JPEG:1,GIF:2,PNG:3,BMP:4,UNKNOWN:255},D={RAW_DATA:0,BASE64_DATA:1},a={BUSSINESS_ID:"10001",AUTH_KEY:"617574686b6579",SERVER_IP:"182.140.186.147"},c={SOUND:2106,FILE:2107},P={IMAGE:1,FILE:2,SHORT_VIDEO:3,SOUND:4},u={APP_VERSION:"2.1",SERVER_VERSION:1},h={C2C:1,GROUP_COMMON:3,GROUP_TIP:4,GROUP_SYSTEM:5,GROUP_TIP2:6,FRIEND_NOTICE:7,PROFILE_NOTICE:8,C2C_COMMON:9,C2C_EVENT:10},G={COMMON:0},l={READED:92,KICKEDOUT:96},F={COMMON:0,LOVEMSG:1,TIP:2,REDPACKET:3},R={REDPACKET:1,COMMON:2,LOVEMSG:3},S={JOIN:1,QUIT:2,KICK:3,SET_ADMIN:4,CANCEL_ADMIN:5,MODIFY_GROUP_INFO:6,MODIFY_MEMBER_INFO:7},O={FACE_URL:1,NAME:2,OWNER:3,NOTIFICATION:4,INTRODUCTION:5},U={JOIN_GROUP_REQUEST:1,JOIN_GROUP_ACCEPT:2,JOIN_GROUP_REFUSE:3,KICK:4,DESTORY:5,CREATE:6,INVITED_JOIN_GROUP_REQUEST:7,QUIT:8,SET_ADMIN:9,CANCEL_ADMIN:10,REVOKE:11,READED:15,CUSTOM:255,INVITED_JOIN_GROUP_REQUEST_AGREE:12},K={FRIEND_ADD:1,FRIEND_DELETE:2,PENDENCY_ADD:3,PENDENCY_DELETE:4,BLACK_LIST_ADD:5,BLACK_LIST_DELETE:6,PENDENCY_REPORT:7,FRIEND_UPDATE:8},p={PROFILE_MODIFY:1},J={OK:0,SIGNATURE_EXPIRATION:11},m={INIT:-1,ON:0,RECONNECT:1,OFF:9999},Y={GROUP_MSG:1,C2C_MSG:2,USER_HEAD:3,GROUP_HEAD:4},d={ING:14,STOP:15},N=15e3,k=10,y=m.INIT,L=!1,H=0,v=6e4,T=5e3,x=60008,j=91101,z=null,W=0,b=10,q=0,V=20,Z=0,X=null,_=null,$=0,AA=[],eA=null,iA=null,oA={sdkAppID:null,appIDAt3rd:null,identifier:null,accountType:null,tinyid:null,identifierNick:null,userSig:null,a2:null,contentType:"json",apn:1},gA={},nA=0,tA={},CA=0,EA=[],IA=[],sA=20,QA=[],rA={downloadMap:{}},BA={"[惊讶]":0,"[撇嘴]":1,"[色]":2,"[发呆]":3,"[得意]":4,"[流泪]":5,"[害羞]":6,"[闭嘴]":7,"[睡]":8,"[大哭]":9,"[尴尬]":10,"[发怒]":11,"[调皮]":12,"[龇牙]":13,"[微笑]":14,"[难过]":15,"[酷]":16,"[冷汗]":17,"[抓狂]":18,"[吐]":19,"[偷笑]":20,"[可爱]":21,"[白眼]":22,"[傲慢]":23,"[饿]":24,"[困]":25,"[惊恐]":26,"[流汗]":27,"[憨笑]":28,"[大兵]":29,"[奋斗]":30,"[咒骂]":31,"[疑问]":32,"[嘘]":33,"[晕]":34},wA={0:["[惊讶]",""],1:["[撇嘴]",""],2:["[色]",""],3:["[发呆]",""],4:["[得意]",""],5:["[流泪]",""],
            6:["[害羞]",""],7:["[闭嘴]",""],8:["[睡]",""],9:["[大哭]",""],10:["[尴尬]",""],11:["[发怒]",""],
            12:["[调皮]",""],13:["[龇牙]",""],14:["[微笑]",""],15:["[难过]",""],16:["[酷]",""],17:["[冷汗]",""],18:["[抓狂]",""],19:["[吐]",""],
            20:["[偷笑]",""],21:["[可爱]",""],22:["[白眼]",""],23:["[傲慢]",""],24:["[饿]",""],25:["[困]",""],26:["[惊恐]",""],27:["[流汗]",""],28:["[憨笑]",""],29:["[大兵]",""],
            30:["[奋斗]",""],31:["[咒骂]",""],32:["[疑问]",""],33:["[嘘]",""],34:["[晕]",""]},MA=new function(){this.formatTimeStamp=function(A,e){if(!A)return 0;var i;e=e||"yyyy-MM-dd hh:mm:ss";var o=new Date(1e3*A),g={"M+":o.getMonth()+1,"d+":o.getDate(),"h+":o.getHours(),"m+":o.getMinutes(),"s+":o.getSeconds()};i=/(y+)/.test(e)?e.replace(RegExp.$1,(o.getFullYear()+"").substr(4-RegExp.$1.length)):e;for(var n in g)new RegExp("("+n+")").test(i)&&(i=i.replace(RegExp.$1,1==RegExp.$1.length?g[n]:("00"+g[n]).substr((""+g[n]).length)));return i},this.groupTypeEn2Ch=function(A){var e=null;switch(A){case"Public":e="公开群";break;case"ChatRoom":e="聊天室";break;case"Private":e="私有群";break;case"AVChatRoom":e="直播聊天室";break;default:e=A}return e},this.groupTypeCh2En=function(A){var e=null;switch(A){case"公开群":e="Public";break;case"聊天室":e="ChatRoom";break;case"私有群":e="Private";break;case"直播聊天室":e="AVChatRoom";break;default:e=A}return e},this.groupRoleEn2Ch=function(A){var e=null;switch(A){case"Member":e="成员";break;case"Admin":e="管理员";break;case"Owner":e="群主";break;default:e=A}return e},this.groupRoleCh2En=function(A){var e=null;switch(A){case"成员":e="Member";break;case"管理员":e="Admin";break;case"群主":e="Owner";break;default:e=A}return e},this.groupMsgFlagEn2Ch=function(A){var e=null;switch(A){case"AcceptAndNotify":e="接收并提示";break;case"AcceptNotNotify":e="接收不提示";break;case"Discard":e="屏蔽";break;default:e=A}return e},this.groupMsgFlagCh2En=function(A){var e=null;switch(A){case"接收并提示":e="AcceptAndNotify";break;case"接收不提示":e="AcceptNotNotify";break;case"屏蔽":e="Discard";break;default:e=A}return e},this.formatText2Html=function(A){var e=A;return e&&(e=this.xssFilter(e),e=e.replace(/ /g,"&nbsp;"),e=e.replace(/\n/g,"<br/>")),e},this.formatHtml2Text=function(A){var e=A;return e&&(e=e.replace(/&nbsp;/g," "),e=e.replace(/<br\/>/g,"\n")),e},this.getStrBytes=function(A){if(null==A||void 0===A)return 0;if("string"!=typeof A)return 0;var e,i,o,g=0;for(i=0,o=A.length;i<o;i++)e=A.charCodeAt(i),g+=e<=127?1:e<=2047?2:e<=65535?3:4;return g},this.xssFilter=function(A){return A=A.toString(),A=A.replace(/[<]/g,"&lt;"),A=A.replace(/[>]/g,"&gt;"),A=A.replace(/"/g,"&quot;")},this.trimStr=function(A){return A?(A=A.toString(),A.replace(/(^\s*)|(\s*$)/g,"")):""},this.validNumber=function(A){return A=A.toString(),A.match(/(^\d{1,8}$)/g)},this.getReturnError=function(A,e){e||(e=-100);var i={ActionStatus:r.FAIL,ErrorCode:e,ErrorInfo:A+"["+e+"]"};return i},this.setCookie=function(A,e,i,o,g){var n=new Date;n.setTime(n.getTime()+1e3*i),document.cookie=A+"="+escape(e)+";expires="+n.toGMTString()},this.getCookie=function(A){var e=document.cookie.match(new RegExp("(^| )"+A+"=([^;]*)(;|$)"));return null!=e?unescape(e[2]):null},this.delCookie=function(A){var e=new Date;e.setTime(e.getTime()-1);var i=this.getCookie(A);null!=i&&(document.cookie=A+"="+escape(i)+";expires="+e.toGMTString())},this.getQueryString=function(A){var e=new RegExp("(^|&)"+A+"=([^&]*)(&|$)","i"),i=window.location.search.substr(1).match(e);return null!=i?unescape(i[2]):null},this.isIE=function(A){var e=document.createElement("b");return e.innerHTML="<!--[if IE "+A+"]><i></i><![endif]-->",1===e.getElementsByTagName("i").length},this.getBrowserInfo=function(){var A={},e=navigator.userAgent.toLowerCase();fA.info("navigator.userAgent="+e);
            var i;return(i=e.match(/msie ([\d.]+)/))?A.ie=i[1]:(i=e.match(/firefox\/([\d.]+)/))?A.firefox=i[1]:(i=e.match(/chrome\/([\d.]+)/))?A.chrome=i[1]:(i=e.match(/opera.([\d.]+)/))?A.opera=i[1]:(i=e.match(/version\/([\d.]+).*safari/))?A.safari=i[1]:0,A.ie?{type:"ie",ver:A.ie}:A.firefox?{type:"firefox",ver:A.firefox}:A.chrome?{type:"chrome",ver:A.chrome}:A.opera?{type:"opera",ver:A.opera}:A.safari?{type:"safari",ver:A.safari}:{type:"unknow",ver:-1}}},fA=new function(){var A=!0;this.setOn=function(e){A=e},this.getOn=function(){return A},this.error=function(e){try{A&&console.error(e)}catch(A){}},this.warn=function(e){try{A&&console.warn(e)}catch(A){}},this.info=function(e){try{A&&console.info(e)}catch(A){}},this.debug=function(e){try{A&&console.debug(e)}catch(A){}}},DA=function(A){return A||(A=new Date),Math.round(A.getTime()/1e3)},aA=function(){return CA?CA+=1:CA=Math.round(1e7*Math.random()),CA},cA=function(){return Math.round(4294967296*Math.random())},PA=function(){var A=null;if(window.XMLHttpRequest)A=new XMLHttpRequest;else try{A=new ActiveXObject("Msxml2.XMLHTTP")}catch(e){try{A=new ActiveXObject("Microsoft.XMLHTTP")}catch(A){return null}}return A},uA=function(A,e,i,o,g,n,t){var C,E,I=PA();if(!I){E="创建请求失败";var C=MA.getReturnError(E,-1);return fA.error(E),void(t&&t(C))}nA++,tA[nA]=I,I.open(A,e,!0),I.onreadystatechange=function(){4==I.readyState&&(tA[nA]=null,200==I.status?(n&&n(I.responseText),I=null,H=W=0):(I=null,setTimeout(function(){var A="请求服务器失败,请检查你的网络是否正常",e=MA.getReturnError(A,-2);t&&t(e)},16)))},I.setRequestHeader("Content-Type","application/x-www-form-urlencoded"),o||(o=N),o&&(I.timeout=o,I.ontimeout=function(A){I=null}),I.send(i)},hA=function(A,e,i,o,g,n,t){uA(A,e,JSON.stringify(i),o,g,function(A){var e=null;A&&(e=JSON.parse(A)),n&&n(e)},t)},GA=function(){return oA.sdkAppID&&oA.identifier},lA=function(A,e){if(!GA()){if(e){var i="请登录",o=MA.getReturnError(i,-4);A&&A(o)}return!1}return!0},FA=function(){return i},RA=function(A,i,g,n){var E=o;E=FA()?o.FORMAL.COMMON:o.TEST.COMMON,A==t.PIC&&(E=FA()?o.FORMAL.PIC:o.TEST.PIC);var I=E+"/"+C[A]+"/"+A+"/"+i+"?websdkappid="+e.APPID+"&v="+e.VERSION+"&platform="+e.PLAATFORM;if(GA()){if("login"==i)I+="&identifier="+encodeURIComponent(oA.identifier)+"&usersig="+oA.userSig;else if(oA.tinyid&&oA.a2)I+="&tinyid="+oA.tinyid+"&a2="+oA.a2;else if(n)return fA.error("tinyid或a2为空["+A+"]["+i+"]"),n(MA.getReturnError("tinyid或a2为空["+A+"]["+i+"]",-5)),!1;I+="&contenttype="+oA.contentType}return I+="&sdkappid="+oA.sdkAppID+"&apn="+oA.apn+"&reqtime="+DA()+"&accounttype="+oA.accountType},SA=function(A,e){var i=null;return eA&&AA[0]?i="http://"+AA[0]+"/asn.com/stddownload_common_file?authkey="+eA+"&bid="+a.BUSSINESS_ID+"&subbid="+oA.sdkAppID+"&fileid="+A+"&filetype="+c.SOUND+"&openid="+e+"&ver=0":fA.error("拼接语音下载url不报错：ip或者authkey为空"),i},OA=function(A,e,i){var o=null;return eA&&AA[0]?o="http://"+AA[0]+"/asn.com/stddownload_common_file?authkey="+eA+"&bid="+a.BUSSINESS_ID+"&subbid="+oA.sdkAppID+"&fileid="+A+"&filetype="+c.FILE+"&openid="+e+"&ver=0&filename="+encodeURIComponent(i):fA.error("拼接文件下载url不报错：ip或者authkey为空"),rA.downloadMap["uuid_"+A]=o,o},UA=function(A,e,i,o,g,n,t){var C={From_Account:e,To_Account:g,os_platform:10,Timestamp:DA().toString(),Random:cA().toString(),request_info:[{busi_id:n,download_flag:o,type:t,uuid:A,version:u.SERVER_VERSION,auth_key:eA,ip:AA[0]}]};de(C,function(A){0==A.error_code&&A.response_info&&(rA.downloadMap["uuid_"+C.uuid]=A.response_info.url),onAppliedDownloadUrl&&onAppliedDownloadUrl({uuid:C.uuid,url:A.response_info.url,maps:rA.downloadMap})},function(A){fA.error("获取下载地址失败",C.uuid)})},KA=function(){for(var A in tA){var e=tA[A];e&&(e.abort(),tA[nA]=null)}nA=0,tA={}},pA=function(){KA(),oA={sdkAppID:null,appIDAt3rd:null,identifier:null,identifierNick:null,accountType:null,userSig:null,contentType:"json",apn:1},gA={},CA=0,Z=0,X=null,QA=[],Te.clear(),z=null},JA=function(e,o,g,n,t){return pA(),g&&(gA=g),"false"==A.Tool.getQueryString("isAccessFormalEnv")&&(i=!1,fA.error("请切换为正式环境")),0==gA.isAccessFormalEnv&&(fA.error("请切换为正式环境"),i=gA.isAccessFormalEnv),0==gA.isLogOn&&fA.setOn(gA.isLogOn),!e&&t?void t(MA.getReturnError("loginInfo is empty",-6)):!e.sdkAppID&&t?void t(MA.getReturnError("loginInfo.sdkAppID is empty",-7)):!e.accountType&&t?void t(MA.getReturnError("loginInfo.accountType is empty",-8)):(e.identifier&&(oA.identifier=e.identifier.toString()),e.identifier&&!e.userSig&&t?void t(MA.getReturnError("loginInfo.userSig is empty",-9)):(e.userSig&&(oA.userSig=e.userSig.toString()),oA.sdkAppID=e.sdkAppID,oA.accountType=e.accountType,void(oA.identifier&&oA.userSig?dA(function(A,e){Te.init(o,function(i){n&&(i.identifierNick=A,i.headurl=e,n(i))},t)},t):Te.init(o,n,t))))},mA=function(){g=MA.getBrowserInfo(),fA.info("BROWSER_INFO: type="+g.type+", ver="+g.ver),"ie"==g.type&&parseInt(g.ver)<10&&(n=!0)},YA=function(A,i,o){if("longpolling"!=A||i!=x&&i!=j){var g=E[A];if(g){var n=DA(),t=null,C={Code:i,ErrMsg:o};if(oA.a2?t=oA.a2.substring(0,10)+"_"+n+"_"+cA():oA.userSig&&(t=oA.userSig.substring(0,10)+"_"+n+"_"+cA()),t){var I={UniqKey:t,EventId:g,ReportTime:n,MsgCmdErrorCode:C};if("login"==A){var s=[];s.push(I);var Q={EvtItems:s,MainVersion:e.VERSION,Version:"0"};me(Q,function(A){s=null},function(A){s=null})}else if(QA.push(I),QA.length>=sA){var r={EvtItems:QA,MainVersion:e.VERSION,Version:"0"};me(r,function(A){QA=[]},function(A){QA=[]})}}}}},dA=function(A,e){Ne.apiCall(t.OPEN_IM,"login",{State:"Online"},function(i){if(i.TinyId)oA.tinyid=i.TinyId;else if(e)return void e(MA.getReturnError("TinyId is empty",-10));if(i.A2Key)oA.a2=i.A2Key;else if(e)return void e(MA.getReturnError("A2Key is empty",-11));var o=["Tag_Profile_IM_Nick","Tag_Profile_IM_Image"],g={From_Account:oA.identifier,To_Account:[oA.identifier],LastStandardSequence:0,TagList:o};Fe(g,function(e){var i;if(e.UserProfileItem&&e.UserProfileItem.length>0)for(var o in e.UserProfileItem)for(var g in e.UserProfileItem[o].ProfileItem)switch(e.UserProfileItem[o].ProfileItem[g].Tag){case"Tag_Profile_IM_Nick":i=e.UserProfileItem[o].ProfileItem[g].Value,i&&(oA.identifierNick=i);break;case"Tag_Profile_IM_Image":image=e.UserProfileItem[o].ProfileItem[g].Value,image&&(oA.headurl=image)}A&&A(oA.identifierNick,oA.headurl)},e)},e)},NA=function(A,e,i){return lA(i,!1)?void("all"==A?Ne.apiCall(t.OPEN_IM,"logout",{},function(A){pA(),e&&e(A)},i):Ne.apiCall(t.OPEN_IM,"longpollinglogout",{LongPollingId:z},function(A){pA(),e&&e(A)},i)):(pA(),void(e&&e({ActionStatus:r.OK,ErrorCode:0,ErrorInfo:"logout success"})))},kA=function(A,e,i){if(lA(i,!0)){var o=null;switch(A.sess.type()){case I.C2C:o={From_Account:oA.identifier,To_Account:A.sess.id().toString(),MsgTimeStamp:A.time,MsgSeq:A.seq,MsgRandom:A.random,MsgBody:[]};break;case I.GROUP:var g=A.getSubType();switch(o={GroupId:A.sess.id().toString(),From_Account:oA.identifier,Random:A.random,MsgBody:[]},g){case F.COMMON:o.MsgPriority="COMMON";break;case F.REDPACKET:o.MsgPriority="REDPACKET";break;case F.LOVEMSG:o.MsgPriority="LOVEMSG";break;case F.TIP:fA.error("不能主动发送群提示消息,subType="+g);break;default:return void fA.error("发送群消息时，出现未知子消息类型：subType="+g)}}for(var n in A.elems){var C=A.elems[n],E=null,s=C.type;switch(s){case w.TEXT:E={Text:C.content.text};break;case w.FACE:E={Index:C.content.index,Data:C.content.data};break;case w.IMAGE:var Q=[];for(var r in C.content.ImageInfoArray)Q.push({Type:C.content.ImageInfoArray[r].type,Size:C.content.ImageInfoArray[r].size,Width:C.content.ImageInfoArray[r].width,Height:C.content.ImageInfoArray[r].height,URL:C.content.ImageInfoArray[r].url});E={ImageFormat:C.content.ImageFormat,UUID:C.content.UUID,ImageInfoArray:Q};break;case w.SOUND:fA.warn("web端暂不支持发送语音消息");continue;case w.LOCATION:fA.warn("web端暂不支持发送地理位置消息");continue;case w.FILE:E={UUID:C.content.uuid,FileName:C.content.name,FileSize:C.content.size,DownloadFlag:C.content.downFlag};break;case w.CUSTOM:E={Data:C.content.data,Desc:C.content.desc,Ext:C.content.ext},s=w.CUSTOM;break;default:fA.warn("web端暂不支持发送"+C.type+"消息");continue}A.PushInfoBoolean&&(o.OfflinePushInfo=A.PushInfo),o.MsgBody.push({MsgType:s,MsgContent:E})}A.sess.type()==I.C2C?Ne.apiCall(t.OPEN_IM,"sendmsg",o,e,i):A.sess.type()==I.GROUP&&Ne.apiCall(t.GROUP,"send_group_msg",o,e,i)}},yA=function(A,e,o){(i||"undefined"==typeof stopPolling||1!=stopPolling)&&lA(o,!0)&&Ne.apiCall(t.OPEN_IM,"longpolling",A,e,o,v,!0)},LA=function(A,e,i,o){Ne.apiCall(t.BIG_GROUP_LONG_POLLING,"get_msg",A,e,i,o)},HA=function(A,e,i,o){lA(o,!0)&&Ne.apiCall(t.OPEN_IM,"getmsg",{Cookie:A,SyncFlag:e},function(A){if(A.MsgList&&A.MsgList.length)for(var e in A.MsgList)EA.push(A.MsgList[e]);1==A.SyncFlag?HA(A.Cookie,A.SyncFlag,i,o):(A.MsgList=EA,EA=[],i&&i(A))},o)},vA=function(A,e,i,o){if(lA(o,!0)){var g=[];for(var n in e){var C={To_Account:e[n].toAccount,LastedMsgTime:e[n].lastedMsgTime};g.push(C)}Ne.apiCall(t.OPEN_IM,"msgreaded",{C2CMsgReaded:{Cookie:A,C2CMsgReadedItem:g}},i,o)}},TA=function(A,e,i){lA(i,!0)&&Ne.apiCall(t.OPEN_IM,"deletemsg",A,e,i)},xA=function(A,e,i){lA(i,!0)&&Ne.apiCall(t.OPEN_IM,"getroammsg",A,function(o){var g=A.MaxCnt,n=o.Complete,t=o.MaxCnt,C=o.MsgKey,E=o.LastMsgTime;if(o.MsgList&&o.MsgList.length)for(var I in o.MsgList)IA.push(o.MsgList[I]);var s=null;0==n&&t<g&&(s={Peer_Account:A.Peer_Account,MaxCnt:g-t,LastMsgTime:E,MsgKey:C}),s?xA(s,e,i):(o.MsgList=IA,IA=[],e&&e(o))},i)},jA=function(A,e,i){if(lA(i,!0)){for(var o={Type:A.Type,Name:A.Name},g=[],n=0;n<A.MemberList.length;n++)g.push({Member_Account:A.MemberList[n]});o.MemberList=g,A.GroupId&&(o.GroupId=A.GroupId),A.Owner_Account&&(o.Owner_Account=A.Owner_Account),A.Introduction&&(o.Introduction=A.Introduction),A.Notification&&(o.Notification=A.Notification),A.MaxMemberCount&&(o.MaxMemberCount=A.MaxMemberCount),A.ApplyJoinOption&&(o.ApplyJoinOption=A.ApplyJoinOption),A.AppDefinedData&&(o.AppDefinedData=A.AppDefinedData),A.FaceUrl&&(o.FaceUrl=A.FaceUrl),Ne.apiCall(t.GROUP,"create_group",o,e,i)}},zA=function(A,e,i){lA(i,!0)&&Ne.apiCall(t.GROUP,"create_group",A,e,i)},WA=function(A,e,i){lA(i,!0)&&Ne.apiCall(t.GROUP,"modify_group_base_info",A,e,i)},bA=function(A,e,i){lA(i,!0)&&Ne.apiCall(t.GROUP,"apply_join_group",{GroupId:A.GroupId,ApplyMsg:A.ApplyMsg,UserDefinedField:A.UserDefinedField},e,i)},qA=function(A,e,i){var o;o=lA(i,!1)?t.GROUP:t.BIG_GROUP,Ne.apiCall(o,"apply_join_group",{GroupId:A.GroupId,ApplyMsg:A.ApplyMsg,UserDefinedField:A.UserDefinedField},function(o){if(o.JoinedStatus&&"JoinedSuccess"==o.JoinedStatus){if(!o.LongPollingKey)return void(i&&i(MA.getReturnError("Join Group succeed; But the type of group is not AVChatRoom: groupid="+A.GroupId,-12)));Te.setBigGroupLongPollingOn(!0),Te.setBigGroupLongPollingKey(o.LongPollingKey),Te.setBigGroupLongPollingMsgMap(A.GroupId,0),Te.bigGroupLongPolling()}e&&e(o)},function(A){i&&i(A)})},VA=function(A,e,i){lA(i,!0)&&Ne.apiCall(t.GROUP,"handle_apply_join_group",{GroupId:A.GroupId,Applicant_Account:A.Applicant_Account,HandleMsg:A.HandleMsg,Authentication:A.Authentication,MsgKey:A.MsgKey,ApprovalMsg:A.ApprovalMsg,UserDefinedField:A.UserDefinedField},e,function(A){if(10024==A.ErrorCode){if(e){var o={ActionStatus:r.OK,ErrorCode:0,ErrorInfo:"该申请已经被处理过"};e(o)}}else i&&i(A)})},ZA=function(A,e,i){lA(i,!0)&&Ne.apiCall(t.GROUP,"get_pendency",{StartTime:A.StartTime,Limit:A.Limit,Handle_Account:oA.identifier},e,function(A){})},XA=function(A,e,i){lA(i,!0)&&Ne.apiCall(t.GROUP,"report_pendency",{ReportTime:A.ReportTime,From_Account:oA.identifier},e,function(A){})},_A=function(A,e,i){lA(i,!0)&&Ne.apiCall(t.GROUP,"handle_invite_join_group",{GroupId:A.GroupId,Inviter_Account:A.Inviter_Account,HandleMsg:A.HandleMsg,Authentication:A.Authentication,MsgKey:A.MsgKey,ApprovalMsg:A.ApprovalMsg,UserDefinedField:A.UserDefinedField},e,function(A){})},$A=function(A,e,i){lA(i,!0)&&Ne.apiCall(t.GROUP,"quit_group",{GroupId:A.GroupId},e,i)},Ae=function(A,e,i){var o;o=lA(i,!1)?t.GROUP:t.BIG_GROUP,Ne.apiCall(o,"quit_group",{GroupId:A.GroupId},function(A){Te.resetBigGroupLongPollingInfo(),e&&e(A)},i)},ee=function(A,e,i){Ne.apiCall(t.GROUP,"search_group",A,e,i)},ie=function(A,e,i){lA(i,!0)&&Ne.apiCall(t.GROUP,"get_group_public_info",{GroupIdList:A.GroupIdList,ResponseFilter:{GroupBasePublicInfoFilter:A.GroupBasePublicInfoFilter}},function(A){if(A.ErrorInfo="",A.GroupInfo)for(var o in A.GroupInfo){var g=A.GroupInfo[o].ErrorCode;g>0&&(A.ActionStatus=r.FAIL,A.GroupInfo[o].ErrorInfo="["+g+"]"+A.GroupInfo[o].ErrorInfo,A.ErrorInfo+=A.GroupInfo[o].ErrorInfo+"\n")}A.ActionStatus==r.FAIL?i&&i(A):e&&e(A)},i)},oe=function(A,e,i){if(lA(i,!0)){var o={GroupIdList:A.GroupIdList,ResponseFilter:{GroupBaseInfoFilter:A.GroupBaseInfoFilter,MemberInfoFilter:A.MemberInfoFilter}};A.AppDefinedDataFilter_Group&&(o.ResponseFilter.AppDefinedDataFilter_Group=A.AppDefinedDataFilter_Group),A.AppDefinedDataFilter_GroupMember&&(o.ResponseFilter.AppDefinedDataFilter_GroupMember=A.AppDefinedDataFilter_GroupMember),Ne.apiCall(t.GROUP,"get_group_info",o,e,i)}},ge=function(A,e,i){lA(i,!0)&&Ne.apiCall(t.GROUP,"get_group_member_info",{GroupId:A.GroupId,Offset:A.Offset,Limit:A.Limit,MemberInfoFilter:A.MemberInfoFilter,MemberRoleFilter:A.MemberRoleFilter,AppDefinedDataFilter_GroupMember:A.AppDefinedDataFilter_GroupMember},e,i)},ne=function(A,e,i){lA(i,!0)&&Ne.apiCall(t.GROUP,"add_group_member",{GroupId:A.GroupId,Silence:A.Silence,MemberList:A.MemberList},e,i)},te=function(A,e,i){if(lA(i,!0)){var o={};A.GroupId&&(o.GroupId=A.GroupId),A.Member_Account&&(o.Member_Account=A.Member_Account),A.Role&&(o.Role=A.Role),A.MsgFlag&&(o.MsgFlag=A.MsgFlag),A.ShutUpTime&&(o.ShutUpTime=A.ShutUpTime),A.NameCard&&(o.NameCard=A.NameCard),A.AppMemberDefinedData&&(o.AppMemberDefinedData=A.AppMemberDefinedData),Ne.apiCall(t.GROUP,"modify_group_member_info",o,e,i)}},Ce=function(A,e,i){lA(i,!0)&&Ne.apiCall(t.GROUP,"delete_group_member",{GroupId:A.GroupId,Silence:A.Silence,MemberToDel_Account:A.MemberToDel_Account,Reason:A.Reason},e,i)},Ee=function(A,e,i){lA(i,!0)&&Ne.apiCall(t.GROUP,"destroy_group",{GroupId:A.GroupId},e,i)},Ie=function(A,e,i){lA(i,!0)&&Ne.apiCall(t.GROUP,"change_group_owner",A,e,i)},se=function(A,e,i){lA(i,!0)&&Ne.apiCall(t.GROUP,"get_joined_group_list",{Member_Account:A.Member_Account,Limit:A.Limit,Offset:A.Offset,GroupType:A.GroupType,ResponseFilter:{GroupBaseInfoFilter:A.GroupBaseInfoFilter,SelfInfoFilter:A.SelfInfoFilter}},e,i)},Qe=function(A,e,i){lA(i,!0)&&Ne.apiCall(t.GROUP,"get_role_in_group",{GroupId:A.GroupId,User_Account:A.User_Account},e,i)},re=function(A,e,i){lA(i,!0)&&Ne.apiCall(t.GROUP,"forbid_send_msg",{GroupId:A.GroupId,Members_Account:A.Members_Account,ShutUpTime:A.ShutUpTime},e,i)},Be=function(A,e,i){lA(i,!0)&&Ne.apiCall(t.GROUP,"send_group_system_notification",A,e,i)},we=function(A,e,i){lA(i,!0)&&Ne.apiCall(t.GROUP,"group_msg_get",{GroupId:A.GroupId,ReqMsgSeq:A.ReqMsgSeq,ReqMsgNumber:A.ReqMsgNumber},e,i)},Me=function(A,e,i){lA(i,!0)&&Ne.apiCall(t.GROUP,"msg_read_report",{GroupId:A.GroupId,MsgReadedSeq:A.MsgReadedSeq},e,i)},fe=function(A){var e=[];if(A.Fail_Account&&A.Fail_Account.length&&(e=A.Fail_Account),A.Invalid_Account&&A.Invalid_Account.length)for(var i in A.Invalid_Account)e.push(A.Invalid_Account[i]);if(e.length){A.ActionStatus=r.FAIL,A.ErrorCode=B,A.ErrorInfo="";for(var o in e){var g=e[o];for(var n in A.ResultItem)if(A.ResultItem[n].To_Account==g){var t=A.ResultItem[n].ResultCode;A.ResultItem[n].ResultInfo="["+t+"]"+A.ResultItem[n].ResultInfo,A.ErrorInfo+=A.ResultItem[n].ResultInfo+"\n";break}}}return A},De=function(A,e,i){lA(i,!0)&&Ne.apiCall(t.FRIEND,"friend_add",{From_Account:oA.identifier,AddFriendItem:A.AddFriendItem},function(A){var o=fe(A);o.ActionStatus==r.FAIL?i&&i(o):e&&e(o)},i)},ae=function(A,e,i){lA(i,!0)&&Ne.apiCall(t.FRIEND,"friend_delete",{From_Account:oA.identifier,To_Account:A.To_Account,DeleteType:A.DeleteType},function(A){var o=fe(A);o.ActionStatus==r.FAIL?i&&i(o):e&&e(o)},i)},ce=function(A,e,i){lA(i,!0)&&(1==A.chatType?Ne.apiCall(t.DEL_CHAT,"delete",{From_Account:oA.identifier,Type:A.chatType,To_Account:A.To_Account},e,i):Ne.apiCall(t.DEL_CHAT,"delete",{From_Account:oA.identifier,Type:A.chatType,ToGroupid:A.To_Account},e,i))},Pe=function(A,e,i){lA(i,!0)&&Ne.apiCall(t.FRIEND,"pendency_get",{From_Account:oA.identifier,PendencyType:A.PendencyType,StartTime:A.StartTime,MaxLimited:A.MaxLimited,LastSequence:A.LastSequence},e,i)},ue=function(A,e,i){lA(i,!0)&&Ne.apiCall(t.FRIEND,"PendencyReport",{From_Account:oA.identifier,LatestPendencyTimeStamp:A.LatestPendencyTimeStamp},e,i)},he=function(A,e,i){lA(i,!0)&&Ne.apiCall(t.FRIEND,"pendency_delete",{From_Account:oA.identifier,PendencyType:A.PendencyType,To_Account:A.To_Account},function(A){var o=fe(A);o.ActionStatus==r.FAIL?i&&i(o):e&&e(o)},i)},Ge=function(A,e,i){lA(i,!0)&&Ne.apiCall(t.FRIEND,"friend_response",{From_Account:oA.identifier,ResponseFriendItem:A.ResponseFriendItem},function(A){var o=fe(A);o.ActionStatus==r.FAIL?i&&i(o):e&&e(o)},i)},le=function(A,e,i){lA(i,!0)&&Ne.apiCall(t.FRIEND,"friend_get_all",{From_Account:oA.identifier,TimeStamp:A.TimeStamp,StartIndex:A.StartIndex,GetCount:A.GetCount,LastStandardSequence:A.LastStandardSequence,TagList:A.TagList},e,i)},Fe=function(A,e,i){A.To_Account.length>100&&(A.To_Account.length=100,fA.error("获取用户资料人数不能超过100人")),lA(i,!0)&&Ne.apiCall(t.PROFILE,"portrait_get",{From_Account:oA.identifier,To_Account:A.To_Account,TagList:A.TagList},function(A){var o=[];if(A.Fail_Account&&A.Fail_Account.length&&(o=A.Fail_Account),A.Invalid_Account&&A.Invalid_Account.length)for(var g in A.Invalid_Account)o.push(A.Invalid_Account[g]);if(o.length){A.ActionStatus=r.FAIL,A.ErrorCode=B,A.ErrorInfo="";for(var n in o){var t=o[n];for(var C in A.UserProfileItem)if(A.UserProfileItem[C].To_Account==t){var E=A.UserProfileItem[C].ResultCode;A.UserProfileItem[C].ResultInfo="["+E+"]"+A.UserProfileItem[C].ResultInfo,A.ErrorInfo+="账号:"+t+","+A.UserProfileItem[C].ResultInfo+"\n";break}}}A.ActionStatus==r.FAIL?i&&i(A):e&&e(A)},i)},Re=function(A,e,i){lA(i,!0)&&Ne.apiCall(t.PROFILE,"portrait_set",{From_Account:oA.identifier,ProfileItem:A.ProfileItem},function(i){for(var o in A.ProfileItem){var g=A.ProfileItem[o];if("Tag_Profile_IM_Nick"==g.Tag){oA.identifierNick=g.Value;break}}e&&e(i)},i)},Se=function(A,e,i){lA(i,!0)&&Ne.apiCall(t.FRIEND,"black_list_add",{From_Account:oA.identifier,To_Account:A.To_Account},function(A){var o=fe(A);o.ActionStatus==r.FAIL?i&&i(o):e&&e(o)},i)},Oe=function(A,e,i){lA(i,!0)&&Ne.apiCall(t.FRIEND,"black_list_delete",{From_Account:oA.identifier,To_Account:A.To_Account},function(A){var o=fe(A);o.ActionStatus==r.FAIL?i&&i(o):e&&e(o)},i)},Ue=function(A,e,i){lA(i,!0)&&Ne.apiCall(t.FRIEND,"black_list_get",{From_Account:oA.identifier,StartIndex:A.StartIndex,MaxLimited:A.MaxLimited,LastSequence:A.LastSequence},e,i)},Ke=function(A,e,i){lA(i,!0)&&Ne.apiCall(t.RECENT_CONTACT,"get",{From_Account:oA.identifier,Count:A.Count},e,i)},pe=function(A,e,i){if(lA(i,!0)){var o;o=FA()?"pic_up":"pic_up_test",Ne.apiCall(t.PIC,o,{App_Version:u.APP_VERSION,From_Account:oA.identifier,To_Account:A.To_Account,Seq:A.Seq,Timestamp:A.Timestamp,Random:A.Random,File_Str_Md5:A.File_Str_Md5,File_Size:A.File_Size,File_Type:A.File_Type,Server_Ver:u.SERVER_VERSION,Auth_Key:eA,Busi_Id:A.Busi_Id,PkgFlag:A.PkgFlag,Slice_Offset:A.Slice_Offset,Slice_Size:A.Slice_Size,Slice_Data:A.Slice_Data},e,i)}},Je=function(A,e){lA(e,!0)&&Ne.apiCall(t.OPEN_IM,"authkey",{},A,e)},me=function(A,e,i){lA(i,!0)&&Ne.apiCall(t.IM_OPEN_STAT,"web_report",A,e,i)},Ye=function(A,e,i){lA(i,!0)&&Ne.apiCall(t.OPEN_IM,"getlongpollingid",{},function(A){e&&e(A)},i)},de=function(A,e,i){Ne.apiCall(t.PIC,"apply_download",A,e,i)};mA();var Ne=0==n?new function(){var A=null;this.init=function(e,i,o){e&&(A=e)},this.callBack=function(e){A&&A(e)},this.clear=function(){A=null},this.apiCall=function(A,e,i,o,g,n,t){var C=RA(A,e,o,g);0!=C&&hA("POST",C,i,n,t,function(n){var t=null,E="";"pic_up"==e&&(i.Slice_Data="");var I="\n request url: \n"+C+"\n request body: \n"+JSON.stringify(i)+"\n response: \n"+JSON.stringify(n);n.ActionStatus==r.OK?(fA.info("["+A+"]["+e+"]success: "+I),o&&o(n),t=0,E=""):(t=n.ErrorCode,E=n.ErrorInfo,g&&(n.SrcErrorInfo=n.ErrorInfo,n.ErrorInfo="["+A+"]["+e+"]failed: "+I,"longpolling"==e&&n.ErrorCode==x||fA.error(n.ErrorInfo),g(n))),YA(e,t,E)},function(A){g&&g(A),YA(e,A.ErrorCode,A.ErrorInfo)})}}:new function(){var A=null;this.init=function(e,i,o){e&&(A=e)},this.callBack=function(e){A&&A(e)},this.clear=function(){A=null},this.apiCall=function(A,e,i,o,g,n,t){var C=RA(A,e,o,g);if(0!=C){var E=Z++,I="jsonpcallback",s="jsonpRequest"+E,Q=document.createElement("script"),B=0;window[s]=_,Q.type="text/javascript",C=C+"&"+I+"="+s+"&jsonpbody="+encodeURIComponent(JSON.stringify(i)),Q.src=C,Q.async=!0,"undefined"!=typeof Q.onreadystatechange&&(Q.event="onclick",Q.htmlFor=Q.id="_jsonpRequest_"+E),Q.onload=Q.onreadystatechange=function(){if(this.readyState&&"complete"!==this.readyState&&"loaded"!==this.readyState||B)return!1;Q.onload=Q.onreadystatechange=null,Q.onclick&&Q.onclick();var n=X,t="\n request url: \n"+C+"\n request body: \n"+JSON.stringify(i)+"\n response: \n"+JSON.stringify(n);n.ActionStatus==r.OK?(fA.info("["+A+"]["+e+"]success: "+t),o&&o(n)):(n.ErrorInfo="["+A+"]["+e+"]failed "+t,"longpolling"!=e||n.ErrorCode!=x?fA.error(n.ErrorInfo):fA.warn("["+A+"]["+e+"]success: "+t),g&&g(n)),X=void 0,document.body.removeChild(Q),B=1},document.body.appendChild(Q)}}},ke=function(A,e,i,o,g,n){this._impl={skey:ke.skey(A,e),type:A,id:e,name:i,icon:o,unread:0,isAutoRead:!1,time:g>=0?g:0,curMaxMsgSeq:n>=0?n:0,msgs:[],isFinished:1}};ke.skey=function(A,e){return A+e},ke.prototype.type=function(){return this._impl.type},ke.prototype.id=function(){return this._impl.id},ke.prototype.name=function(){return this._impl.name},ke.prototype.icon=function(){return this._impl.icon},ke.prototype.unread=function(A){return"undefined"==typeof A?this._impl.unread:void(this._impl.unread=A)},ke.prototype.isFinished=function(A){return"undefined"==typeof A?this._impl.isFinished:void(this._impl.isFinished=A)},ke.prototype.time=function(){return this._impl.time},ke.prototype.curMaxMsgSeq=function(A){return"undefined"==typeof A?this._impl.curMaxMsgSeq:void(this._impl.curMaxMsgSeq=A)},ke.prototype.msgCount=function(){return this._impl.msgs.length},ke.prototype.msg=function(A){return this._impl.msgs[A]},ke.prototype.msgs=function(){return this._impl.msgs},ke.prototype._impl_addMsg=function(A){this._impl.msgs.push(A),A.time>this._impl.time&&(this._impl.time=A.time),A.seq>this._impl.curMaxMsgSeq&&(this._impl.curMaxMsgSeq=A.seq),A.isSend||this._impl.isAutoRead||this._impl.unread++};var ye=function(A,e){this.toAccount=A,this.lastedMsgTime=e},Le=function(A,e){for(var i=parseInt(A).toString(2)+"00000000000000000000000000000000",o=parseInt(e).toString(2),g=i.split("").reverse(),n=o.split("").reverse(),t=[],C=g.length>n.length?g.length:n.length,E=0;E<C;E++)sig=Number(g[E]||0)||Number(n[E]||0),t.push(sig);var I=t.reverse().join(""),s={high:"0x"+parseInt(I.substr(0,I.length-32),2).toString(16),low:"0x"+parseInt(I.substr(I.length-32-1),2).toString(16)},Q=new Long(s.low,s.high,!0);return Q.toString()},He=function(A,e,i,o,g,n,t,C){this.sess=A,this.subType=t>=0?t:0,this.fromAccount=n,this.fromAccountNick=C?C:n,this.isSend=Boolean(e),this.seq=i>=0?i:aA(),this.random=o>=0?o:cA(),this.time=g>=0?g:DA(),this.elems=[];var E=A.type();switch(E){case I.GROUP:this.uniqueId=Le(this.seq,this.random);break;case I.C2C:default:this.uniqueId=Le(this.time,this.random)}};He.prototype.getSession=function(){return this.sess},He.prototype.getType=function(){return this.subType},He.prototype.getSubType=function(){return this.subType},He.prototype.getFromAccount=function(){return this.fromAccount},He.prototype.getFromAccountNick=function(){return this.fromAccountNick},He.prototype.getIsSend=function(){return this.isSend},He.prototype.getSeq=function(){return this.seq},He.prototype.getTime=function(){return this.time},He.prototype.getRandom=function(){return this.random},He.prototype.getElems=function(){return this.elems},He.prototype.getMsgUniqueId=function(){return this.uniqueId},He.prototype.addText=function(e){this.addElem(new A.Msg.Elem(w.TEXT,e))},He.prototype.addFace=function(e){this.addElem(new A.Msg.Elem(w.FACE,e))},He.prototype.addImage=function(e){this.addElem(new A.Msg.Elem(w.IMAGE,e))},He.prototype.addLocation=function(e){this.addElem(new A.Msg.Elem(w.LOCATION,e))},He.prototype.addFile=function(e){this.addElem(new A.Msg.Elem(w.FILE,e))},He.prototype.addCustom=function(e){this.addElem(new A.Msg.Elem(w.CUSTOM,e))},He.prototype.addElem=function(A){this.elems.push(A)},He.prototype.toHtml=function(){var A="";for(var e in this.elems){var i=this.elems[e];A+=i.toHtml()}return A},He.Elem=function(A,e){this.type=A,this.content=e},He.Elem.prototype.getType=function(){return this.type},He.Elem.prototype.getContent=function(){return this.content},He.Elem.prototype.toHtml=function(){var A;return A=this.content.toHtml()},He.Elem.Text=function(A){this.text=MA.xssFilter(A)},He.Elem.Text.prototype.getText=function(){return this.text},He.Elem.Text.prototype.toHtml=function(){return this.text},He.Elem.Face=function(A,e){this.index=A,this.data=e},He.Elem.Face.prototype.getIndex=function(){return this.index},He.Elem.Face.prototype.getData=function(){return this.data},He.Elem.Face.prototype.toHtml=function(){var A=null,e=BA[this.data],i=wA[e];return i&&i[1]&&(A=i[1]),A?"<img src='"+A+"'/>":this.data},He.Elem.Location=function(A,e,i){this.latitude=e,this.longitude=A,this.desc=i},He.Elem.Location.prototype.getLatitude=function(){return this.latitude},He.Elem.Location.prototype.getLongitude=function(){return this.longitude},He.Elem.Location.prototype.getDesc=function(){return this.desc},He.Elem.Location.prototype.toHtml=function(){return"经度="+this.longitude+",纬度="+this.latitude+",描述="+this.desc},He.Elem.Images=function(A,e){this.UUID=A,"number"!=typeof e&&(e=parseInt(f[e]||f.UNKNOWN,10)),this.ImageFormat=e,this.ImageInfoArray=[]},He.Elem.Images.prototype.addImage=function(A){this.ImageInfoArray.push(A)},He.Elem.Images.prototype.toHtml=function(){var A=this.getImage(M.SMALL),e=this.getImage(M.LARGE),i=this.getImage(M.ORIGIN);return e||(e=A),i||(i=A),"<img src='"+A.getUrl()+"#"+e.getUrl()+"#"+i.getUrl()+"' style='CURSOR: hand' id='"+this.getImageId()+"' bigImgUrl='"+e.getUrl()+"' onclick='imageClick(this)' />"},He.Elem.Images.prototype.getImageId=function(){return this.UUID},He.Elem.Images.prototype.getImageFormat=function(){return this.ImageFormat},He.Elem.Images.prototype.getImage=function(A){for(var e in this.ImageInfoArray)if(this.ImageInfoArray[e].getType()==A)return this.ImageInfoArray[e];return null},He.Elem.Images.Image=function(A,e,i,o,g){this.type=A,this.size=e,this.width=i,this.height=o,this.url=g},He.Elem.Images.Image.prototype.getType=function(){return this.type},He.Elem.Images.Image.prototype.getSize=function(){return this.size},He.Elem.Images.Image.prototype.getWidth=function(){return this.width},He.Elem.Images.Image.prototype.getHeight=function(){return this.height},He.Elem.Images.Image.prototype.getUrl=function(){return this.url},He.Elem.Sound=function(A,e,i,o,g,n,t){this.uuid=A,this.second=e,this.size=i,this.senderId=o,this.receiverId=g,this.downFlag=n,this.busiId=t==I.C2C?2:1,void 0!==n&&void 0!==busiId?UA(A,o,e,n,g,this.busiId,P.SOUND):this.downUrl=SA(A,o,e)},He.Elem.Sound.prototype.getUUID=function(){return this.uuid},He.Elem.Sound.prototype.getSecond=function(){return this.second},He.Elem.Sound.prototype.getSize=function(){return this.size},He.Elem.Sound.prototype.getSenderId=function(){return this.senderId},He.Elem.Sound.prototype.getDownUrl=function(){return this.downUrl},He.Elem.Sound.prototype.toHtml=function(){return"ie"==g.type&&parseInt(g.ver)<=8?"[这是一条语音消息]demo暂不支持ie8(含)以下浏览器播放语音,语音URL:"+this.downUrl:'<audio id="uuid_'+this.uuid+'" src="'+this.downUrl+'" controls="controls" onplay="onChangePlayAudio(this)" preload="none"></audio>'},He.Elem.File=function(A,e,i,o,g,n,t){this.uuid=A,this.name=e,this.size=i,this.senderId=o,this.receiverId=g,this.downFlag=n,this.busiId=t==I.C2C?2:1,void 0!==n&&void 0!==busiId?UA(A,o,e,n,g,this.busiId,P.FILE):this.downUrl=OA(A,o,e)},He.Elem.File.prototype.getUUID=function(){return this.uuid},He.Elem.File.prototype.getName=function(){return this.name},He.Elem.File.prototype.getSize=function(){return this.size},He.Elem.File.prototype.getSenderId=function(){return this.senderId},He.Elem.File.prototype.getDownUrl=function(){return this.downUrl},He.Elem.File.prototype.getDownFlag=function(){return this.downFlag},He.Elem.File.prototype.toHtml=function(){var A,e;return A=this.size,e="Byte",this.size>=1024&&(A=Math.round(this.size/1024),e="KB"),'<a href="javascript" onclick="webim.onDownFile("'+this.uuid+'")" title="点击下载文件" ><i class="glyphicon glyphicon-file">&nbsp;'+this.name+"("+A+e+")</i></a>"},He.Elem.GroupTip=function(A,e,i,o,g){this.opType=A,this.opUserId=e,this.groupId=i,this.groupName=o,this.userIdList=g?g:[],this.groupInfoList=[],this.memberInfoList=[],this.groupMemberNum=null},He.Elem.GroupTip.prototype.addGroupInfo=function(A){this.groupInfoList.push(A)},He.Elem.GroupTip.prototype.addMemberInfo=function(A){this.memberInfoList.push(A)},He.Elem.GroupTip.prototype.getOpType=function(){return this.opType},He.Elem.GroupTip.prototype.getOpUserId=function(){return this.opUserId},He.Elem.GroupTip.prototype.getGroupId=function(){return this.groupId},He.Elem.GroupTip.prototype.getGroupName=function(){return this.groupName},He.Elem.GroupTip.prototype.getUserIdList=function(){return this.userIdList},He.Elem.GroupTip.prototype.getGroupInfoList=function(){return this.groupInfoList},He.Elem.GroupTip.prototype.getMemberInfoList=function(){return this.memberInfoList},He.Elem.GroupTip.prototype.getGroupMemberNum=function(){return this.groupMemberNum},He.Elem.GroupTip.prototype.setGroupMemberNum=function(A){return this.groupMemberNum=A},He.Elem.GroupTip.prototype.toHtml=function(){var A="[群提示消息]",e=k-1;switch(this.opType){case S.JOIN:A+=this.opUserId+"邀请了";for(var i in this.userIdList)if(A+=this.userIdList[i]+",",this.userIdList.length>k&&i==e){A+="等"+this.userIdList.length+"人";break}A+="加入该群";break;case S.QUIT:A+=this.opUserId+"主动退出该群";break;case S.KICK:A+=this.opUserId+"将";for(var i in this.userIdList)if(A+=this.userIdList[i]+",",this.userIdList.length>k&&i==e){A+="等"+this.userIdList.length+"人";break}A+="踢出该群";break;case S.SET_ADMIN:A+=this.opUserId+"将";for(var i in this.userIdList)if(A+=this.userIdList[i]+",",this.userIdList.length>k&&i==e){A+="等"+this.userIdList.length+"人";break}A+="设为管理员";break;case S.CANCEL_ADMIN:A+=this.opUserId+"取消";for(var i in this.userIdList)if(A+=this.userIdList[i]+",",this.userIdList.length>k&&i==e){A+="等"+this.userIdList.length+"人";break}A+="的管理员资格";break;case S.MODIFY_GROUP_INFO:A+=this.opUserId+"修改了群资料：";for(var i in this.groupInfoList){var o=this.groupInfoList[i].getType(),g=this.groupInfoList[i].getValue();switch(o){case O.FACE_URL:A+="群头像为"+g+"; ";break;case O.NAME:A+="群名称为"+g+"; ";break;case O.OWNER:A+="群主为"+g+"; ";break;case O.NOTIFICATION:A+="群公告为"+g+"; ";break;case O.INTRODUCTION:A+="群简介为"+g+"; ";break;default:A+="未知信息为:type="+o+",value="+g+"; "}}break;case S.MODIFY_MEMBER_INFO:A+=this.opUserId+"修改了群成员资料:";for(var i in this.memberInfoList){var n=this.memberInfoList[i].getUserId(),t=this.memberInfoList[i].getShutupTime();if(A+=n+": ",A+=null!=t&&void 0!==t?0==t?"取消禁言; ":"禁言"+t+"秒; ":" shutupTime为空",this.memberInfoList.length>k&&i==e){A+="等"+this.memberInfoList.length+"人";break}}break;case S.READED:Log.info("消息已读同步");break;default:A+="未知群提示消息类型：type="+this.opType}return A},He.Elem.GroupTip.GroupInfo=function(A,e){this.type=A,this.value=e},He.Elem.GroupTip.GroupInfo.prototype.getType=function(){return this.type},He.Elem.GroupTip.GroupInfo.prototype.getValue=function(){return this.value},He.Elem.GroupTip.MemberInfo=function(A,e){this.userId=A,this.shutupTime=e},He.Elem.GroupTip.MemberInfo.prototype.getUserId=function(){return this.userId},He.Elem.GroupTip.MemberInfo.prototype.getShutupTime=function(){return this.shutupTime},He.Elem.Custom=function(A,e,i){this.data=A,this.desc=e,this.ext=i;
            },He.Elem.Custom.prototype.getData=function(){return this.data},He.Elem.Custom.prototype.getDesc=function(){return this.desc},He.Elem.Custom.prototype.getExt=function(){return this.ext},He.Elem.Custom.prototype.toHtml=function(){return this.data};var ve=new function(){var A={},e=[];window.msgCache={},this.cookie="",this.syncFlag=0;var i=function(e){for(var i in A)e(A[i])},o=function(A){var e=!1,i=A.sess._impl.skey,o=A.isSend+A.seq+A.random,g=msgCache[i]&&msgCache[i][o];return g&&(e=!0),msgCache[i]?msgCache[i][o]={time:A.time}:(msgCache[i]={},msgCache[i][o]={time:A.time}),e};this.sessMap=function(){return A},this.sessCount=function(){return e.length},this.sessByTypeId=function(e,i){var o=ke.skey(e,i);return void 0===o||null==o?null:A[o]},this.delSessByTypeId=function(e,i){var o=ke.skey(e,i);return void 0!==o&&null!=o&&(A[o]&&(delete A[o],delete msgCache[o]),!0)},this.resetCookieAndSyncFlag=function(){this.cookie="",this.syncFlag=0},this.setAutoRead=function(A,e,o){if(o&&i(function(A){A._impl.isAutoRead=!1}),A&&(A._impl.isAutoRead=e,e))if(A._impl.unread=0,A._impl.type==I.C2C){var g=[];g.push(new ye(A._impl.id,A._impl.time)),vA(ve.cookie,g,function(A){fA.info("[setAutoRead]: c2CMsgReaded success")},function(A){fA.error("[setAutoRead}: c2CMsgReaded failed:"+A.ErrorInfo)})}else if(A._impl.type==I.GROUP){var n={GroupId:A._impl.id,MsgReadedSeq:A._impl.curMaxMsgSeq};Me(n,function(A){fA.info("groupMsgReaded success")},function(A){fA.error("groupMsgReaded failed:"+A.ErrorInfo)})}},this.c2CMsgReaded=function(A,e,i){var o=[];o.push(new ye(A.To_Account,A.LastedMsgTime)),vA(ve.cookie,o,function(A){e&&(fA.info("c2CMsgReaded success"),e(A))},function(A){i&&(fA.error("c2CMsgReaded failed:"+A.ErrorInfo),i(A))})},this.addSession=function(e){A[e._impl.skey]=e},this.delSession=function(e){delete A[e._impl.skey]},this.addMsg=function(e){if(o(e))return!1;var i=e.sess;return A[i._impl.skey]||this.addSession(i),i._impl_addMsg(e),!0},this.updateTimeline=function(){var A=new Array;i(function(e){A.push(e)}),A.sort(function(A,e){return e.time-A.time}),e=A}},Te=new function(){var A=null,e=null,i={1:null,2:null,3:null,4:null,5:null,6:null,7:null,8:null,9:null,10:null,11:null,15:null,255:null,12:null},o={1:null,2:null,3:null,4:null,5:null,6:null,7:null,8:null},g={1:null},n=!1,t=0,C=0,E=null,s=!1,Q=0,B=90,M=null,f={},D={92:null,96:null},a=null,c=null,P=0,u={},G={};this.setLongPollingOn=function(A){n=A},this.getLongPollingOn=function(){return n},this.resetLongPollingInfo=function(){n=!1,t=0,C=0},this.setBigGroupLongPollingOn=function(A){s=A},this.setBigGroupLongPollingKey=function(A){M=A},this.resetBigGroupLongPollingInfo=function(){s=!1,Q=0,M=null,f={}},this.setBigGroupLongPollingMsgMap=function(A,e){var i=f[A];i?(i=parseInt(i)+e,f[A]=i):f[A]=e},this.clear=function(){e=null,i={1:null,2:null,3:null,4:null,5:null,6:null,7:null,8:null,9:null,10:null,11:null,15:null,255:null,12:null},o={1:null,2:null,3:null,4:null,5:null,6:null,7:null,8:null},g={1:null},A=null,n=!1,t=0,C=0,E=null,s=!1,Q=0,M=null,f={},G={},AA=[],eA=null,iA=null};var J=function(A,e){Je(function(e){AA=e.IpList,eA=e.AuthKey,iA=e.ExpireTime,A&&A(e)},function(A){fA.error("initIpAndAuthkey failed:"+A.ErrorInfo),e&&e(A)})},Y=function(A,e){var i={Member_Account:oA.identifier,Limit:1e3,Offset:0,GroupBaseInfoFilter:["NextMsgSeq"]};se(i,function(e){if(!e.GroupIdList||0==e.GroupIdList.length)return fA.info("initMyGroupMaxSeqs: 目前还没有加入任何群组"),void(A&&A(e));for(var i=0;i<e.GroupIdList.length;i++){var o=e.GroupIdList[i].GroupId,g=e.GroupIdList[i].NextMsgSeq-1;u[o]=g}A&&A(e)},function(A){fA.error("initMyGroupMaxSeqs failed:"+A.ErrorInfo),e&&e(A)})},N=function(A,e,i){P++;var o={GroupId:A,ReqMsgSeq:e,ReqMsgNumber:i};fA.warn("第"+P+"次补齐群消息,参数="+JSON.stringify(o)),Te.syncGroupMsgs(o)},k=function(A,e){var i=u[A];i?e>i&&(u[A]=e):u[A]=e},q=function(A,e){for(var i in A){var o=A[i];if(o.From_Account){var g=sA(o,!1,!0);g&&e.push(g),k(o.ToGroupId,o.MsgSeq)}}return e},V=function(e,i){var o={},g=[],n=99999999,t=-1;for(var E in i){var I=o[i[E].ToGroupId];I||(I=o[i[E].ToGroupId]={min:n,max:t,msgs:[]}),i[E].NoticeSeq>C&&(fA.warn("noticeSeq="+C+",msgNoticeSeq="+i[E].NoticeSeq),C=i[E].NoticeSeq),i[E].Event=e,o[i[E].ToGroupId].msgs.push(i[E]),i[E].MsgSeq<I.min&&(o[i[E].ToGroupId].min=i[E].MsgSeq),i[E].MsgSeq>I.max&&(o[i[E].ToGroupId].max=i[E].MsgSeq)}for(var s in o){var Q=o[s].max-o[s].min+1,r=u[s];r?o[s].min-r>1||o[s].msgs.length<Q?(fA.warn("发起一次补齐群消息请求,curMaxMsgSeq="+r+", minMsgSeq="+o[s].min+", maxMsgSeq="+o[s].max+", msgs.length="+o[s].msgs.length+", tempCount="+Q),N(s,o[s].max,o[s].max-r),k(s,o[s].max)):g=q(o[s].msgs,g):(fA.warn("不存在该群的最大消息seq，群id="+s),o[s].msgs.length<Q?(fA.warn("发起一次补齐群消息请求,minMsgSeq="+o[s].min+", maxMsgSeq="+o[s].max+", msgs.length="+o[s].msgs.length+", tempCount="+Q),N(s,o[s].max,Q),k(s,o[s].max)):g=q(o[s].msgs,g))}g.length&&ve.updateTimeline(),A&&g.length&&A(g)},Z=function(e,i){var o={},g=[],n=99999999,t=-1;for(var E in i){var I=o[i[E].ToGroupId];I||(I=o[i[E].ToGroupId]={min:n,max:t,msgs:[]}),i[E].NoticeSeq>C&&(fA.warn("noticeSeq="+C+",msgNoticeSeq="+i[E].NoticeSeq),C=i[E].NoticeSeq),i[E].Event=e,o[i[E].ToGroupId].msgs.push(i[E]),i[E].MsgSeq<I.min&&(o[i[E].ToGroupId].min=i[E].MsgSeq),i[E].MsgSeq>I.max&&(o[i[E].ToGroupId].max=i[E].MsgSeq)}for(var s in o){var Q=o[s].max-o[s].min+1,r=u[s];r?o[s].min-r>1||o[s].msgs.length<Q?(fA.warn("发起一次补齐群消息请求,curMaxMsgSeq="+r+", minMsgSeq="+o[s].min+", maxMsgSeq="+o[s].max+", msgs.length="+o[s].msgs.length+", tempCount="+Q),N(s,o[s].max,o[s].max-r),k(s,o[s].max)):g=q(o[s].msgs,g):(fA.warn("不存在该群的最大消息seq，群id="+s),o[s].msgs.length<Q?(fA.warn("发起一次补齐群消息请求,minMsgSeq="+o[s].min+", maxMsgSeq="+o[s].max+", msgs.length="+o[s].msgs.length+", tempCount="+Q),N(s,o[s].max,Q),k(s,o[s].max)):g=q(o[s].msgs,g))}g.length&&ve.updateTimeline(),A&&g.length&&A(g)},X=function(A,e){for(var o in A){var g=A[o],n=g.MsgBody,t=n.ReportType;0==e&&g.NoticeSeq&&g.NoticeSeq>C&&(C=g.NoticeSeq);g.GroupInfo.To_Account;if(e){var E=g.ToGroupId+"_"+t+"_"+n.Operator_Account,I=G[E];if(I){fA.warn("收到重复的群系统消息：key="+E);continue}G[E]=!0}var s={SrcFlag:0,ReportType:t,GroupId:g.ToGroupId,GroupName:g.GroupInfo.GroupName,Operator_Account:n.Operator_Account,MsgTime:g.MsgTimeStamp,groupReportTypeMsg:n};switch(t){case U.JOIN_GROUP_REQUEST:s.RemarkInfo=n.RemarkInfo,s.MsgKey=n.MsgKey,s.Authentication=n.Authentication,s.UserDefinedField=g.UserDefinedField,s.From_Account=g.From_Account,s.MsgSeq=g.ClientSeq,s.MsgRandom=g.MsgRandom;break;case U.JOIN_GROUP_ACCEPT:case U.JOIN_GROUP_REFUSE:s.RemarkInfo=n.RemarkInfo;break;case U.KICK:case U.DESTORY:case U.CREATE:case U.INVITED_JOIN_GROUP_REQUEST:case U.INVITED_JOIN_GROUP_REQUEST_AGREE:case U.QUIT:case U.SET_ADMIN:case U.CANCEL_ADMIN:case U.REVOKE:break;case U.READED:break;case U.CUSTOM:s.MsgSeq=g.MsgSeq,s.UserDefinedField=n.UserDefinedField;break;default:fA.error("未知群系统消息类型：reportType="+t)}if(e)t==U.JOIN_GROUP_REQUEST&&(i[t]?i[t](s):fA.error("未知群系统消息类型：reportType="+t));else if(i[t])if(t==U.READED)for(var Q=s.groupReportTypeMsg.GroupReadInfoArray,r=0,B=Q.length;r<B;r++){var w=Q[r];i[t](w)}else i[t](s)}},_=function(A,e){var i,g,n;for(var t in A){switch(i=A[t],g=i.PushType,0==e&&i.NoticeSeq&&i.NoticeSeq>C&&(C=i.NoticeSeq),n={Type:g},g){case K.FRIEND_ADD:n.Accounts=i.FriendAdd_Account;break;case K.FRIEND_DELETE:n.Accounts=i.FriendDel_Account;break;case K.PENDENCY_ADD:n.PendencyList=i.PendencyAdd;break;case K.PENDENCY_DELETE:n.Accounts=i.FrienPencydDel_Account;break;case K.BLACK_LIST_ADD:n.Accounts=i.BlackListAdd_Account;break;case K.BLACK_LIST_DELETE:n.Accounts=i.BlackListDel_Account;break;default:fA.error("未知好友系统通知类型：friendNotice="+JSON.stringify(i))}e?g==K.PENDENCY_ADD&&o[g]&&o[g](n):o[g]&&o[g](n)}},$=function(A,e){var i,o,n;for(var t in A){switch(i=A[t],o=i.PushType,0==e&&i.NoticeSeq&&i.NoticeSeq>C&&(C=i.NoticeSeq),n={Type:o},o){case p.PROFILE_MODIFY:n.Profile_Account=i.Profile_Account,n.ProfileList=i.ProfileList;break;default:fA.error("未知资料系统通知类型：profileNotice="+JSON.stringify(i))}e?o==p.PROFILE_MODIFY&&g[o]&&g[o](n):g[o]&&g[o](n)}},gA=function(A){var e=A.MsgBody,o=e.ReportType,g=(A.GroupInfo.To_Account,{SrcFlag:1,ReportType:o,GroupId:A.ToGroupId,GroupName:A.GroupInfo.GroupName,Operator_Account:e.Operator_Account,MsgTime:A.MsgTimeStamp});switch(o){case U.JOIN_GROUP_REQUEST:g.RemarkInfo=e.RemarkInfo,g.MsgKey=e.MsgKey,g.Authentication=e.Authentication,g.UserDefinedField=A.UserDefinedField,g.From_Account=A.From_Account,g.MsgSeq=A.ClientSeq,g.MsgRandom=A.MsgRandom;break;case U.JOIN_GROUP_ACCEPT:case U.JOIN_GROUP_REFUSE:g.RemarkInfo=e.RemarkInfo;break;case U.KICK:case U.DESTORY:case U.CREATE:case U.INVITED_JOIN_GROUP_REQUEST:case U.INVITED_JOIN_GROUP_REQUEST_AGREE:case U.QUIT:case U.SET_ADMIN:case U.CANCEL_ADMIN:case U.REVOKE:break;case U.CUSTOM:g.MsgSeq=A.MsgSeq,g.UserDefinedField=e.UserDefinedField;break;default:fA.error("未知群系统消息类型：reportType="+o)}i[o]&&i[o](g)},nA=function(A){for(var e=0,i=A.length;e<i;e++)tA(A[e])},tA=function(A){var e=A.SubMsgType;switch(e){case l.READED:if(A.ReadC2cMsgNotify.UinPairReadArray&&D[e])for(var i=0,o=A.ReadC2cMsgNotify.UinPairReadArray.length;i<o;i++){var g=A.ReadC2cMsgNotify.UinPairReadArray[i];D[e](g)}break;case l.KICKEDOUT:D[e]&&D[e]();break;default:fA.error("未知C2c系统消息：subType="+e)}};this.longPolling=function(A,e){function i(){yA(o,function(A){for(var e in A.EventArray){var i=A.EventArray[e];switch(i.Event){case h.C2C:t=i.NotifySeq,fA.warn("longpolling: received new c2c msg"),Te.syncMsgs();break;case h.GROUP_COMMON:fA.warn("longpolling: received new group msgs"),Z(i.Event,i.GroupMsgArray);break;case h.GROUP_TIP:fA.warn("longpolling: received new group tips"),Z(i.Event,i.GroupTips);break;case h.GROUP_TIP2:fA.warn("longpolling: received new group tips"),Z(i.Event,i.GroupTips);break;case h.GROUP_SYSTEM:fA.warn("longpolling: received new group system msgs"),X(i.GroupTips,!1);break;case h.FRIEND_NOTICE:fA.warn("longpolling: received new friend system notice"),_(i.FriendListMod,!1);break;case h.PROFILE_NOTICE:fA.warn("longpolling: received new profile system notice"),$(i.ProfileDataMod,!1);break;case h.C2C_COMMON:C=i.C2cMsgArray[0].NoticeSeq,fA.warn("longpolling: received new c2c_common msg",C),V(i.Event,i.C2cMsgArray);break;case h.C2C_EVENT:C=i.C2cNotifyMsgArray[0].NoticeSeq,fA.warn("longpolling: received new c2c_event msg"),nA(i.C2cNotifyMsgArray);break;default:fA.error("longpolling收到未知新消息类型: Event="+i.Event)}}var o={ActionStatus:r.OK,ErrorCode:0};CA(o)},function(A){CA(A),e&&e(A)})}var o={Timeout:v/1e3,Cookie:{NotifySeq:t,NoticeSeq:C}};z?(o.Cookie.LongPollingId=z,i()):Ye({},function(A){z=o.Cookie.LongPollingId=A.LongPollingId,v=A.Timeout>60?v:1e3*A.Timeout,i()})},this.bigGroupLongPolling=function(A,e){var i={StartSeq:Q,HoldTime:B,Key:M};LA(i,function(e){var i=[];if(Q=e.NextSeq,B=e.HoldTime,M=e.Key,e.RspMsgList&&e.RspMsgList.length>0){for(var o,g,n,t=0,C=e.RspMsgList.length-1;C>=0;C--)if(o=e.RspMsgList[C],!o.IsPlaceMsg&&o.From_Account&&o.MsgBody&&0!=o.MsgBody.length)switch(g=o.Event){case h.GROUP_COMMON:fA.info("bigGroupLongPolling: return new group msg"),n=sA(o,!1,!1),n&&i.push(n),t+=1;break;case h.GROUP_TIP:case h.GROUP_TIP2:fA.info("bigGroupLongPolling: return new group tip"),n=sA(o,!1,!1),n&&i.push(n);break;case h.GROUP_SYSTEM:fA.info("bigGroupLongPolling: new group system msg"),gA(o);break;default:fA.error("bigGroupLongPolling收到未知新消息类型: Event="+g)}t>0&&(Te.setBigGroupLongPollingMsgMap(o.ToGroupId,t),fA.warn("current bigGroupLongPollingMsgMap: "+JSON.stringify(f)))}W=0;var I={ActionStatus:r.OK,ErrorCode:m.ON,ErrorInfo:"connection is ok..."};Ne.callBack(I),A?A(i):E&&E(i),s&&Te.bigGroupLongPolling()},function(A){if(A.ErrorCode!=x&&(fA.error(A.ErrorInfo),W++),A.ErrorCode==j&&(fA.error("多实例登录，被kick"),a&&a()),W<b)s&&Te.bigGroupLongPolling();else{var i={ActionStatus:r.FAIL,ErrorCode:m.OFF,ErrorInfo:"connection is off"};Ne.callBack(i)}e&&e(A)},1e3*B)};var CA=function(A){if(0==A.ErrorCode||A.ErrorCode==x){H=0,L=!1;var e,i=!1;switch(y){case m.INIT:i=!0,y=m.ON,e="create connection successfully(INIT->ON)";break;case m.ON:e="connection is on...(ON->ON)";break;case m.RECONNECT:y=m.ON,e="connection is on...(RECONNECT->ON)";break;case m.OFF:i=!0,y=m.RECONNECT,e="reconnect successfully(OFF->RECONNECT)"}var o={ActionStatus:r.OK,ErrorCode:y,ErrorInfo:e};i&&Ne.callBack(o),n&&Te.longPolling()}else if(A.ErrorCode==j)fA.error("多实例登录，被kick"),a&&a();else if(H++,fA.warn("longPolling接口第"+H+"次报错: "+A.ErrorInfo),H<=b)setTimeout(EA,100);else{y=m.OFF;var g={ActionStatus:r.FAIL,ErrorCode:m.OFF,ErrorInfo:"connection is off"};0==L&&Ne.callBack(g),L=!0,fA.warn(T+"毫秒之后,SDK会发起新的longPolling请求..."),setTimeout(EA,T)}},V=function(e,i){var o=[],g=[];g=i;for(var n in g){var t,C,E,s=g[n];s.From_Account==oA.identifier?(t=!0,C=s.To_Account,E=""):(t=!1,C=s.From_Account,E="");var Q=ve.sessByTypeId(I.C2C,C);Q||(Q=new ke(I.C2C,C,C,E,0,0));var r=new He(Q,t,s.MsgSeq,s.MsgRandom,s.MsgTimeStamp,s.From_Account),B=null,M=null,f=null;for(var D in s.MsgBody){switch(B=s.MsgBody[D],f=B.MsgType){case w.TEXT:M=new He.Elem.Text(B.MsgContent.Text);break;case w.FACE:M=new He.Elem.Face(B.MsgContent.Index,B.MsgContent.Data);break;case w.IMAGE:M=new He.Elem.Images(B.MsgContent.UUID,B.MsgContent.ImageFormat||"");for(var a in B.MsgContent.ImageInfoArray){var c=B.MsgContent.ImageInfoArray[a];M.addImage(new He.Elem.Images.Image(c.Type,c.Size,c.Width,c.Height,c.URL))}break;case w.SOUND:B.MsgContent?M=new He.Elem.Sound(B.MsgContent.UUID,B.MsgContent.Second,B.MsgContent.Size,s.From_Account,s.To_Account,B.MsgContent.Download_Flag,I.C2C):(f=w.TEXT,M=new He.Elem.Text("[语音消息]下载地址解析出错"));break;case w.LOCATION:M=new He.Elem.Location(B.MsgContent.Longitude,B.MsgContent.Latitude,B.MsgContent.Desc);break;case w.FILE:case w.FILE+" ":f=w.FILE,B.MsgContent?M=new He.Elem.File(B.MsgContent.UUID,B.MsgContent.FileName,B.MsgContent.FileSize,s.From_Account,s.To_Account,B.MsgContent.Download_Flag,I.C2C):(f=w.TEXT,M=new He.Elem.Text("[文件消息下载地址解析出错]"));break;case w.CUSTOM:try{var P=JSON.parse(B.MsgContent.Data);if(P&&P.userAction&&P.userAction==d.ING)continue}catch(A){}f=w.CUSTOM,M=new He.Elem.Custom(B.MsgContent.Data,B.MsgContent.Desc,B.MsgContent.Ext);break;default:f=w.TEXT,M=new He.Elem.Text("web端暂不支持"+B.MsgType+"消息")}r.elems.push(new He.Elem(f,M))}r.elems.length>0&&ve.addMsg(r)&&o.push(r)}o.length>0&&ve.updateTimeline(),o.length>0&&A&&A(o)},EA=function(){n&&Te.longPolling()},IA=function(A){for(var e in A){var i=A[e];switch(X(i.GroupTips,!0),i.Event){case h.GROUP_SYSTEM:fA.warn("handlerApplyJoinGroupSystemMsgs： handler new group system msg"),X(i.GroupTips,!0);break;default:fA.error("syncMsgs收到未知的群系统消息类型: Event="+i.Event)}}};this.syncMsgs=function(e,i){var o=[],g=[];HA(ve.cookie,ve.syncFlag,function(i){2==i.SyncFlag&&(ve.syncFlag=0),g=i.MsgList,ve.cookie=i.Cookie;for(var n in g){var t,C,E,s=g[n];s.From_Account==oA.identifier?(t=!0,C=s.To_Account,E=""):(t=!1,C=s.From_Account,E="");var Q=ve.sessByTypeId(I.C2C,C);Q||(Q=new ke(I.C2C,C,C,E,0,0));var r=new He(Q,t,s.MsgSeq,s.MsgRandom,s.MsgTimeStamp,s.From_Account),B=null,M=null,f=null;for(var D in s.MsgBody){switch(B=s.MsgBody[D],f=B.MsgType){case w.TEXT:M=new He.Elem.Text(B.MsgContent.Text);break;case w.FACE:M=new He.Elem.Face(B.MsgContent.Index,B.MsgContent.Data);break;case w.IMAGE:M=new He.Elem.Images(B.MsgContent.UUID,B.MsgContent.ImageFormat);for(var a in B.MsgContent.ImageInfoArray){var c=B.MsgContent.ImageInfoArray[a];M.addImage(new He.Elem.Images.Image(c.Type,c.Size,c.Width,c.Height,c.URL))}break;case w.SOUND:B.MsgContent?M=new He.Elem.Sound(B.MsgContent.UUID,B.MsgContent.Second,B.MsgContent.Size,s.From_Account,s.To_Account,B.MsgContent.Download_Flag,I.C2C):(f=w.TEXT,M=new He.Elem.Text("[语音消息]下载地址解析出错"));break;case w.LOCATION:M=new He.Elem.Location(B.MsgContent.Longitude,B.MsgContent.Latitude,B.MsgContent.Desc);break;case w.FILE:case w.FILE+" ":f=w.FILE,B.MsgContent?M=new He.Elem.File(B.MsgContent.UUID,B.MsgContent.FileName,B.MsgContent.FileSize,s.From_Account,s.To_Account,B.MsgContent.Download_Flag,I.C2C):(f=w.TEXT,M=new He.Elem.Text("[文件消息下载地址解析出错]"));break;case w.CUSTOM:try{var P=JSON.parse(B.MsgContent.Data);if(P&&P.userAction&&P.userAction==d.ING)continue}catch(A){}f=w.CUSTOM,M=new He.Elem.Custom(B.MsgContent.Data,B.MsgContent.Desc,B.MsgContent.Ext);break;default:f=w.TEXT,M=new He.Elem.Text("web端暂不支持"+B.MsgType+"消息")}r.elems.push(new He.Elem(f,M))}r.elems.length>0&&ve.addMsg(r)&&o.push(r)}IA(i.EventArray),o.length>0&&ve.updateTimeline(),e?e(o):o.length>0&&A&&A(o)},function(A){fA.error("getMsgs failed:"+A.ErrorInfo),i&&i(A)})},this.getC2CHistoryMsgs=function(A,e,i){if(!A.Peer_Account&&i)return void i(MA.getReturnError("Peer_Account is empty",-13));if(A.MaxCnt||(A.MaxCnt=15),A.MaxCnt<=0&&i)return void i(MA.getReturnError("MaxCnt should be greater than 0",-14));if(A.MaxCnt>15){if(i)return void i(MA.getReturnError("MaxCnt can not be greater than 15",-15))}else{null!=A.MsgKey&&void 0!==A.MsgKey||(A.MsgKey="");var o={Peer_Account:A.Peer_Account,MaxCnt:A.MaxCnt,LastMsgTime:A.LastMsgTime,MsgKey:A.MsgKey};xA(o,function(i){var o=[],g=[];g=i.MsgList;var n=ve.sessByTypeId(I.C2C,A.Peer_Account);n||(n=new ke(I.C2C,A.Peer_Account,A.Peer_Account,"",0,0));for(var t in g){var C,E,s,Q=g[t];Q.From_Account==oA.identifier?(C=!0,E=Q.To_Account,s=""):(C=!1,E=Q.From_Account,s="");var r=new He(n,C,Q.MsgSeq,Q.MsgRandom,Q.MsgTimeStamp,Q.From_Account),B=null,M=null,f=null;for(var D in Q.MsgBody){switch(B=Q.MsgBody[D],f=B.MsgType){case w.TEXT:M=new He.Elem.Text(B.MsgContent.Text);break;case w.FACE:M=new He.Elem.Face(B.MsgContent.Index,B.MsgContent.Data);break;case w.IMAGE:M=new He.Elem.Images(B.MsgContent.UUID,B.MsgContent.ImageFormat);for(var a in B.MsgContent.ImageInfoArray){var c=B.MsgContent.ImageInfoArray[a];M.addImage(new He.Elem.Images.Image(c.Type,c.Size,c.Width,c.Height,c.URL))}break;case w.SOUND:B.MsgContent?M=new He.Elem.Sound(B.MsgContent.UUID,B.MsgContent.Second,B.MsgContent.Size,Q.From_Account,Q.To_Account,B.MsgContent.Download_Flag,I.C2C):(f=w.TEXT,M=new He.Elem.Text("[语音消息]下载地址解析出错"));break;case w.LOCATION:M=new He.Elem.Location(B.MsgContent.Longitude,B.MsgContent.Latitude,B.MsgContent.Desc);break;case w.FILE:case w.FILE+" ":f=w.FILE,B.MsgContent?M=new He.Elem.File(B.MsgContent.UUID,B.MsgContent.FileName,B.MsgContent.FileSize,Q.From_Account,Q.To_Account,B.MsgContent.Download_Flag,I.C2C):(f=w.TEXT,M=new He.Elem.Text("[文件消息下载地址解析出错]"));break;case w.CUSTOM:f=w.CUSTOM,M=new He.Elem.Custom(B.MsgContent.Data,B.MsgContent.Desc,B.MsgContent.Ext);break;default:f=w.TEXT,M=new He.Elem.Text("web端暂不支持"+B.MsgType+"消息")}r.elems.push(new He.Elem(f,M))}ve.addMsg(r),o.push(r)}if(ve.updateTimeline(),e){var P={Complete:i.Complete,MsgCount:o.length,LastMsgTime:i.LastMsgTime,MsgKey:i.MsgKey,MsgList:o};n.isFinished(i.Complete),e(P)}},function(A){fA.error("getC2CHistoryMsgs failed:"+A.ErrorInfo),i&&i(A)})}},this.syncGroupMsgs=function(e,i,o){if(e.ReqMsgSeq<=0){if(o){var g="ReqMsgSeq must be greater than 0",n=MA.getReturnError(g,-16);o(n)}}else{var t={GroupId:e.GroupId,ReqMsgSeq:e.ReqMsgSeq,ReqMsgNumber:e.ReqMsgNumber};we(t,function(e){var o=[],g=(e.GroupId,e.RspMsgList),n=e.IsFinished;if(null==g||void 0===g)return void(i&&i([]));for(var t=g.length-1;t>=0;t--){var C=g[t];if(!C.IsPlaceMsg&&C.From_Account&&C.MsgBody&&0!=C.MsgBody.length){var E=sA(C,!0,!0,n);E&&o.push(E)}}o.length>0&&ve.updateTimeline(),i?i(o):o.length>0&&A&&A(o)},function(A){fA.error("getGroupMsgs failed:"+A.ErrorInfo),o&&o(A)})}};var sA=function(A,i,o,g){if(A.IsPlaceMsg||!A.From_Account||!A.MsgBody||0==A.MsgBody.length)return null;var n,t,C,E,s,Q=A.ToGroupId,r=Q;A.GroupInfo&&A.GroupInfo.GroupName&&(r=A.GroupInfo.GroupName),E=A.From_Account,A.GroupInfo&&(A.GroupInfo.From_AccountNick&&(E=A.GroupInfo.From_AccountNick),s=A.GroupInfo.From_AccountHeadurl?A.GroupInfo.From_AccountHeadurl:null),A.From_Account==oA.identifier?(n=!0,t=A.From_Account,C=""):(n=!1,t=A.From_Account,C="");var B=ve.sessByTypeId(I.GROUP,Q);B||(B=new ke(I.GROUP,Q,r,C,0,0)),"undefined"!=typeof g&&B.isFinished(g||0);var M=F.COMMON;if(h.GROUP_TIP==A.Event||h.GROUP_TIP2==A.Event){M=F.TIP;var f=A.MsgBody;A.MsgBody=[],A.MsgBody.push({MsgType:w.GROUP_TIP,MsgContent:f})}else A.MsgPriority&&(A.MsgPriority==R.REDPACKET?M=F.REDPACKET:A.MsgPriority==R.LOVEMSG&&(M=F.LOVEMSG));var D=new He(B,n,A.MsgSeq,A.MsgRandom,A.MsgTimeStamp,A.From_Account,M,E,s),a=null,c=null,P=null;for(var u in A.MsgBody){switch(a=A.MsgBody[u],P=a.MsgType){case w.TEXT:c=new He.Elem.Text(a.MsgContent.Text);break;case w.FACE:c=new He.Elem.Face(a.MsgContent.Index,a.MsgContent.Data);break;case w.IMAGE:c=new He.Elem.Images(a.MsgContent.UUID,a.MsgContent.ImageFormat||"");for(var G in a.MsgContent.ImageInfoArray)c.addImage(new He.Elem.Images.Image(a.MsgContent.ImageInfoArray[G].Type,a.MsgContent.ImageInfoArray[G].Size,a.MsgContent.ImageInfoArray[G].Width,a.MsgContent.ImageInfoArray[G].Height,a.MsgContent.ImageInfoArray[G].URL));break;case w.SOUND:a.MsgContent?c=new He.Elem.Sound(a.MsgContent.UUID,a.MsgContent.Second,a.MsgContent.Size,A.From_Account,A.To_Account,a.MsgContent.Download_Flag,I.GROUP):(P=w.TEXT,c=new He.Elem.Text("[语音消息]下载地址解析出错"));break;case w.LOCATION:c=new He.Elem.Location(a.MsgContent.Longitude,a.MsgContent.Latitude,a.MsgContent.Desc);break;case w.FILE:case w.FILE+" ":P=w.FILE;OA(a.MsgContent.UUID,A.From_Account,a.MsgContent.FileName);a.MsgContent?c=new He.Elem.File(a.MsgContent.UUID,a.MsgContent.FileName,a.MsgContent.FileSize,A.From_Account,A.To_Account,a.MsgContent.Download_Flag,I.GROUP):(P=w.TEXT,c=new He.Elem.Text("[文件消息]地址解析出错"));break;case w.GROUP_TIP:var l=a.MsgContent.OpType;if(c=new He.Elem.GroupTip(l,a.MsgContent.Operator_Account,Q,A.GroupInfo.GroupName,a.MsgContent.List_Account),S.JOIN==l||S.QUIT==l)c.setGroupMemberNum(a.MsgContent.MemberNum);else if(S.MODIFY_GROUP_INFO==l){var U=!1,K={GroupId:Q,GroupFaceUrl:null,GroupName:null,OwnerAccount:null,GroupNotification:null,GroupIntroduction:null},p=a.MsgContent.MsgGroupNewInfo;if(p.GroupFaceUrl){var J=new He.Elem.GroupTip.GroupInfo(O.FACE_URL,p.GroupFaceUrl);c.addGroupInfo(J),U=!0,K.GroupFaceUrl=p.GroupFaceUrl}if(p.GroupName){var m=new He.Elem.GroupTip.GroupInfo(O.NAME,p.GroupName);c.addGroupInfo(m),U=!0,K.GroupName=p.GroupName}if(p.Owner_Account){var Y=new He.Elem.GroupTip.GroupInfo(O.OWNER,p.Owner_Account);c.addGroupInfo(Y),U=!0,K.OwnerAccount=p.Owner_Account}if(p.GroupNotification){var d=new He.Elem.GroupTip.GroupInfo(O.NOTIFICATION,p.GroupNotification);c.addGroupInfo(d),U=!0,K.GroupNotification=p.GroupNotification}if(p.GroupIntroduction){var N=new He.Elem.GroupTip.GroupInfo(O.INTRODUCTION,p.GroupIntroduction);c.addGroupInfo(N),U=!0,K.GroupIntroduction=p.GroupIntroduction}0==i&&U&&e&&e(K)}else if(S.MODIFY_MEMBER_INFO==l){var k=a.MsgContent.MsgMemberInfo;for(var y in k){var L=k[y];c.addMemberInfo(new He.Elem.GroupTip.MemberInfo(L.User_Account,L.ShutupTime))}}break;case w.CUSTOM:P=w.CUSTOM,c=new He.Elem.Custom(a.MsgContent.Data,a.MsgContent.Desc,a.MsgContent.Ext);break;default:P=w.TEXT,c=new He.Elem.Text("web端暂不支持"+a.MsgType+"消息")}D.elems.push(new He.Elem(P,c))}return 0==o?D:ve.addMsg(D)?D:null};this.init=function(t,C,I){if(t.onMsgNotify||fA.warn("listeners.onMsgNotify is empty"),A=t.onMsgNotify,t.onBigGroupMsgNotify?E=t.onBigGroupMsgNotify:fA.warn("listeners.onBigGroupMsgNotify is empty"),t.onC2cEventNotifys?D=t.onC2cEventNotifys:fA.warn("listeners.onC2cEventNotifys is empty"),t.onGroupSystemNotifys?i=t.onGroupSystemNotifys:fA.warn("listeners.onGroupSystemNotifys is empty"),t.onGroupInfoChangeNotify?e=t.onGroupInfoChangeNotify:fA.warn("listeners.onGroupInfoChangeNotify is empty"),t.onFriendSystemNotifys?o=t.onFriendSystemNotifys:fA.warn("listeners.onFriendSystemNotifys is empty"),t.onProfileSystemNotifys?g=t.onProfileSystemNotifys:fA.warn("listeners.onProfileSystemNotifys is empty"),t.onKickedEventCall?a=t.onKickedEventCall:fA.warn("listeners.onKickedEventCall is empty"),t.onAppliedDownloadUrl?c=t.onAppliedDownloadUrl:fA.warn("listeners.onAppliedDownloadUrl is empty"),oA.identifier&&oA.userSig)Y(function(A){fA.info("initMyGroupMaxSeqs success"),J(function(A){if(fA.info("initIpAndAuthkey success"),C){fA.info("login success(have login state))");var e={ActionStatus:r.OK,ErrorCode:0,ErrorInfo:"login success"};C(e)}Te.setLongPollingOn(!0),n&&Te.longPolling(C)},I)},I);else if(C){var s={ActionStatus:r.OK,ErrorCode:0,ErrorInfo:"login success(no login state)"};C(s)}},this.sendMsg=function(A,e,i){kA(A,function(o){if(A.sess.type()==I.C2C){if(!ve.addMsg(A)){var g="sendMsg: addMsg failed!",n=MA.getReturnError(g,-17);return fA.error(g),void(i&&i(n))}ve.updateTimeline()}e&&e(o)},function(A){i&&i(A)})}},xe=new function(){this.fileMd5=null;var A=function(A,e,i){function o(){var e=E*t,i=e+t>=A.size?A.size:e+t,o=n.call(A,e,i);g.readAsArrayBuffer(o)}var g=null;try{g=new FileReader}catch(A){if(i)return void i(MA.getReturnError("当前浏览器不支持FileReader",-18))}var n=File.prototype.mozSlice||File.prototype.webkitSlice||File.prototype.slice;if(!n&&i)return void i(MA.getReturnError("当前浏览器不支持FileAPI",-19));var t=2097152,C=Math.ceil(A.size/t),E=0,I=new SparkMD5;g.onload=function(A){for(var i="",g=new Uint8Array(A.target.result),n=g.byteLength,t=0;t<n;t++)i+=String.fromCharCode(g[t]);I.appendBinary(i),E++,E<C?o():(this.fileMd5=I.end(),e&&e(this.fileMd5))},o()};this.submitUploadFileForm=function(A,e,i){function o(A,e){var i=document.createElement("input");i.type="hidden",i.name=A,i.value=e,w.appendChild(i)}function g(){var A;try{A=JSON.parse(f.contentWindow.name)||{}}catch(e){A={}}A.ActionStatus?(f.src="about:blank",f.parentNode.removeChild(f),f=null,A.ActionStatus==r.OK?e&&e(A):i&&i(A)):setTimeout(g,100)}var n,t,C=A.formId,E=A.fileId,I=$++,s="uploadResultIframe_"+I,Q=A.To_Account,B=A.businessType,w=document.getElementById(C);if(!w)return n="获取表单对象为空: formId="+C+"(formId非法)",t=MA.getReturnError(n,-20),void(i&&i(t));var M=document.getElementById(E);if(!M)return n="获取文件对象为空: fileId="+E+"(没有选择文件或者fileId非法)",t=MA.getReturnError(n,-21),void(i&&i(t));M.name="file";var f=document.createElement("iframe");f.name=s,f.id=s,f.style.display="none",document.body.appendChild(f);var a;a=FA()?"pic_up":"pic_up_test";var c="https://pic.tim.qq.com/v4/openpic/"+a+"?tinyid="+oA.tinyid+"&a2="+oA.a2+"&sdkappid="+oA.sdkAppID+"&contenttype=http&accounttype="+oA.accountType;w.action=c,w.method="post",w.target=s,o("App_Version",u.APP_VERSION),o("From_Account",oA.identifier),o("To_Account",Q),o("Seq",aA().toString()),o("Timestamp",DA().toString()),o("Random",cA().toString()),o("Busi_Id",B),o("PkgFlag",D.RAW_DATA.toString()),o("Auth_Key",eA),o("Server_Ver",u.SERVER_VERSION.toString()),o("File_Type",A.fileType),setTimeout(g,500),w.submit()},this.uploadFile=function(e,i,o){var g={init:function(A,e,i){var o=this;o.file=A.file,o.onProgressCallBack=A.onProgressCallBack,A.abortButton&&(A.abortButton.onclick=o.abortHandler),o.total=o.file.size,o.loaded=0,o.step=1105920,o.sliceSize=0,o.sliceOffset=0,o.timestamp=DA(),o.seq=aA(),o.random=cA(),o.fromAccount=oA.identifier,o.toAccount=A.To_Account,o.fileMd5=A.fileMd5,o.businessType=A.businessType,o.fileType=A.fileType,o.cbOk=e,o.cbErr=i,o.reader=new FileReader,o.blobSlice=File.prototype.mozSlice||File.prototype.webkitSlice||File.prototype.slice,o.reader.onloadstart=o.onLoadStart,o.reader.onprogress=o.onProgress,o.reader.onabort=o.onAbort,o.reader.onerror=o.onerror,o.reader.onload=o.onLoad,o.reader.onloadend=o.onLoadEnd},upload:function(){var A=g;A.readBlob(0)},onLoadStart:function(){},onProgress:function(A){var e=g;e.loaded+=A.loaded,e.onProgressCallBack&&e.onProgressCallBack(e.loaded,e.total)},onAbort:function(){},onError:function(){},onLoad:function(A){var e=g;if(A.target.readyState==FileReader.DONE){var i=A.target.result,o=i.indexOf(",");o!=-1&&(i=i.substr(o+1));var n={From_Account:e.fromAccount,To_Account:e.toAccount,Busi_Id:e.businessType,File_Type:e.fileType,File_Str_Md5:e.fileMd5,PkgFlag:D.BASE64_DATA,File_Size:e.total,Slice_Offset:e.sliceOffset,Slice_Size:e.sliceSize,Slice_Data:i,Seq:e.seq,Timestamp:e.timestamp,Random:e.random},t=function(A){if(0==A.IsFinish)e.loaded=A.Next_Offset,e.loaded<e.total?e.readBlob(e.loaded):e.loaded=e.total;else if(e.cbOk){var i={ActionStatus:A.ActionStatus,ErrorCode:A.ErrorCode,ErrorInfo:A.ErrorInfo,File_UUID:A.File_UUID,File_Size:A.Next_Offset,URL_INFO:A.URL_INFO,Download_Flag:A.Download_Flag};e.fileType==P.FILE&&(i.URL_INFO=OA(A.File_UUID,oA.identifier,e.file.name)),e.cbOk(i)}q=0},C=function(A){q<V?(q++,setTimeout(function(){pe(n,t,C)},1e3)):e.cbErr(A)};pe(n,t,C)}},onLoadEnd:function(){},readBlob:function(A){var e,i=g,o=i.file,n=A+i.step;n>i.total?(n=i.total,i.sliceSize=n-A):i.sliceSize=i.step,i.sliceOffset=A,e=i.blobSlice.call(o,A,n),i.reader.readAsDataURL(e)},abortHandler:function(){var A=g;A.reader&&A.reader.abort()}};A(e.file,function(A){fA.info("fileMd5: "+A),e.fileMd5=A,g.init(e,i,o),g.upload()},o)}};A.SESSION_TYPE=I,A.MSG_MAX_LENGTH=Q,A.C2C_MSG_SUB_TYPE=G,A.GROUP_MSG_SUB_TYPE=F,A.MSG_ELEMENT_TYPE=w,A.GROUP_TIP_TYPE=S,A.IMAGE_TYPE=M,A.GROUP_SYSTEM_TYPE=U,A.FRIEND_NOTICE_TYPE=K,A.GROUP_TIP_MODIFY_GROUP_INFO_TYPE=O,A.BROWSER_INFO=g,A.Emotions=A.EmotionPicData=wA,A.EmotionDataIndexs=A.EmotionPicDataIndex=BA,A.TLS_ERROR_CODE=J,A.CONNECTION_STATUS=m,A.UPLOAD_PIC_BUSSINESS_TYPE=Y,A.RECENT_CONTACT_TYPE=s,A.UPLOAD_RES_TYPE=P,A.Tool=MA,A.Log=fA,A.Msg=He,A.Session=ke,A.MsgStore={sessMap:function(){return ve.sessMap()},sessCount:function(){return ve.sessCount()},sessByTypeId:function(A,e){return ve.sessByTypeId(A,e)},delSessByTypeId:function(A,e){return ve.delSessByTypeId(A,e)},resetCookieAndSyncFlag:function(){return ve.resetCookieAndSyncFlag()}},A.Resources=rA,A.login=A.init=function(A,e,i,o,g){Ne.init(e.onConnNotify,o,g),e.jsonpCallback&&(_=e.jsonpCallback),JA(A,e,i,o,g)},A.logout=A.offline=function(A,e){return NA("instance",A,e)},A.logoutAll=function(A,e){return NA("all",A,e)},A.sendMsg=function(A,e,i){return Te.sendMsg(A,e,i)},A.syncMsgs=function(A,e){return Te.syncMsgs(A,e)},A.getC2CHistoryMsgs=function(A,e,i){return Te.getC2CHistoryMsgs(A,e,i)},A.syncGroupMsgs=function(A,e,i){return Te.syncGroupMsgs(A,e,i)},A.c2CMsgReaded=function(A,e,i){return ve.c2CMsgReaded(A,e,i)},A.groupMsgReaded=function(A,e,i){return Me(A,e,i)},A.setAutoRead=function(A,e,i){return ve.setAutoRead(A,e,i)},A.createGroup=function(A,e,i){return jA(A,e,i)},A.createGroupHigh=function(A,e,i){return zA(A,e,i)},A.applyJoinGroup=function(A,e,i){return bA(A,e,i)},A.handleApplyJoinGroupPendency=function(A,e,i){return VA(A,e,i)},A.getPendencyGroup=function(A,e,i){return ZA(A,e,i)},A.getPendencyGroupRead=function(A,e,i){return XA(A,e,i)},A.handleInviteJoinGroupRequest=function(A,e,i){return _A(A,e,i)},A.deleteApplyJoinGroupPendency=function(A,e,i){return TA(A,e,i)},A.quitGroup=function(A,e,i){return $A(A,e,i)},A.searchGroupByName=function(A,e,i){return ee(A,e,i)},A.getGroupPublicInfo=function(A,e,i){return ie(A,e,i)},A.getGroupInfo=function(A,e,i){return oe(A,e,i)},A.modifyGroupBaseInfo=function(A,e,i){return WA(A,e,i)},A.getGroupMemberInfo=function(A,e,i){return ge(A,e,i)},A.addGroupMember=function(A,e,i){return ne(A,e,i)},A.modifyGroupMember=function(A,e,i){return te(A,e,i)},A.deleteGroupMember=function(A,e,i){return Ce(A,e,i)},A.destroyGroup=function(A,e,i){return Ee(A,e,i)},A.changeGroupOwner=function(A,e,i){return Ie(A,e,i)},A.getJoinedGroupListHigh=function(A,e,i){return se(A,e,i)},A.getRoleInGroup=function(A,e,i){return Qe(A,e,i)},A.forbidSendMsg=function(A,e,i){return re(A,e,i)},A.sendCustomGroupNotify=function(A,e,i){return Be(A,e,i)},A.applyJoinBigGroup=function(A,e,i){return qA(A,e,i)},A.quitBigGroup=function(A,e,i){return Ae(A,e,i)},A.getProfilePortrait=function(A,e,i){return Fe(A,e,i)},A.setProfilePortrait=function(A,e,i){return Re(A,e,i)},A.applyAddFriend=function(A,e,i){return De(A,e,i)},A.getPendency=function(A,e,i){return Pe(A,e,i)},A.getPendencyReport=function(A,e,i){return ue(A,e,i)},A.deletePendency=function(A,e,i){return he(A,e,i)},A.responseFriend=function(A,e,i){return Ge(A,e,i)},A.getAllFriend=function(A,e,i){return le(A,e,i)},A.deleteChat=function(A,e,i){return ce(A,e,i)},A.deleteFriend=function(A,e,i){return ae(A,e,i)},A.addBlackList=function(A,e,i){
            return Se(A,e,i)},A.deleteBlackList=function(A,e,i){return Oe(A,e,i)},A.getBlackList=function(A,e,i){return Ue(A,e,i)},A.getRecentContactList=function(A,e,i){return Ke(A,e,i)},A.uploadFile=A.uploadPic=function(A,e,i){return xe.uploadFile(A,e,i)},A.submitUploadFileForm=function(A,e,i){return xe.submitUploadFileForm(A,e,i)},A.uploadFileByBase64=A.uploadPicByBase64=function(A,e,i){var o={To_Account:A.toAccount,Busi_Id:A.businessType,File_Type:A.File_Type,File_Str_Md5:A.fileMd5,PkgFlag:D.BASE64_DATA,File_Size:A.totalSize,Slice_Offset:0,Slice_Size:A.totalSize,Slice_Data:A.base64Str,Seq:aA(),Timestamp:DA(),Random:cA()};return pe(o,e,i)},A.setJsonpLastRspData=function(A){X="string"==typeof A?JSON.parse(A):A},A.getLongPollingId=function(A,e,i){return Ye(A,e,i)},A.applyDownload=function(A,e,i){return de(A,e,i)},A.onDownFile=function(A){window.open(rA.downloadMap["uuid_"+A])},A.checkLogin=function(A,e){return lA(A,e)}}(webim);
    </script>
    <!--上传图片需要用到-->
    <script>
      (function (factory) {
    if (typeof exports === 'object') {
        // Node/CommonJS
        module.exports = factory();
    } else if (typeof define === 'function' && define.amd) {
        // AMD
        define(factory);
    } else {
        // Browser globals (with support for web workers)
        var glob;
        try {
            glob = window;
        } catch (e) {
            glob = self;
        }

        glob.SparkMD5 = factory();
    }
}(function (undefined) {

    'use strict';

    ////////////////////////////////////////////////////////////////////////////

    /*
     * Fastest md5 implementation around (JKM md5)
     * Credits: Joseph Myers
     *
     * @see http://www.myersdaily.org/joseph/javascript/md5-text.html
     * @see http://jsperf.com/md5-shootout/7
     */

    /* this function is much faster,
      so if possible we use it. Some IEs
      are the only ones I know of that
      need the idiotic second function,
      generated by an if clause.  */
    var add32 = function (a, b) {
        return (a + b) & 0xFFFFFFFF;
    },

    cmn = function (q, a, b, x, s, t) {
        a = add32(add32(a, q), add32(x, t));
        return add32((a << s) | (a >>> (32 - s)), b);
    },

    ff = function (a, b, c, d, x, s, t) {
        return cmn((b & c) | ((~b) & d), a, b, x, s, t);
    },

    gg = function (a, b, c, d, x, s, t) {
        return cmn((b & d) | (c & (~d)), a, b, x, s, t);
    },

    hh = function (a, b, c, d, x, s, t) {
        return cmn(b ^ c ^ d, a, b, x, s, t);
    },

    ii = function (a, b, c, d, x, s, t) {
        return cmn(c ^ (b | (~d)), a, b, x, s, t);
    },

    md5cycle = function (x, k) {
        var a = x[0],
            b = x[1],
            c = x[2],
            d = x[3];

        a = ff(a, b, c, d, k[0], 7, -680876936);
        d = ff(d, a, b, c, k[1], 12, -389564586);
        c = ff(c, d, a, b, k[2], 17, 606105819);
        b = ff(b, c, d, a, k[3], 22, -1044525330);
        a = ff(a, b, c, d, k[4], 7, -176418897);
        d = ff(d, a, b, c, k[5], 12, 1200080426);
        c = ff(c, d, a, b, k[6], 17, -1473231341);
        b = ff(b, c, d, a, k[7], 22, -45705983);
        a = ff(a, b, c, d, k[8], 7, 1770035416);
        d = ff(d, a, b, c, k[9], 12, -1958414417);
        c = ff(c, d, a, b, k[10], 17, -42063);
        b = ff(b, c, d, a, k[11], 22, -1990404162);
        a = ff(a, b, c, d, k[12], 7, 1804603682);
        d = ff(d, a, b, c, k[13], 12, -40341101);
        c = ff(c, d, a, b, k[14], 17, -1502002290);
        b = ff(b, c, d, a, k[15], 22, 1236535329);

        a = gg(a, b, c, d, k[1], 5, -165796510);
        d = gg(d, a, b, c, k[6], 9, -1069501632);
        c = gg(c, d, a, b, k[11], 14, 643717713);
        b = gg(b, c, d, a, k[0], 20, -373897302);
        a = gg(a, b, c, d, k[5], 5, -701558691);
        d = gg(d, a, b, c, k[10], 9, 38016083);
        c = gg(c, d, a, b, k[15], 14, -660478335);
        b = gg(b, c, d, a, k[4], 20, -405537848);
        a = gg(a, b, c, d, k[9], 5, 568446438);
        d = gg(d, a, b, c, k[14], 9, -1019803690);
        c = gg(c, d, a, b, k[3], 14, -187363961);
        b = gg(b, c, d, a, k[8], 20, 1163531501);
        a = gg(a, b, c, d, k[13], 5, -1444681467);
        d = gg(d, a, b, c, k[2], 9, -51403784);
        c = gg(c, d, a, b, k[7], 14, 1735328473);
        b = gg(b, c, d, a, k[12], 20, -1926607734);

        a = hh(a, b, c, d, k[5], 4, -378558);
        d = hh(d, a, b, c, k[8], 11, -2022574463);
        c = hh(c, d, a, b, k[11], 16, 1839030562);
        b = hh(b, c, d, a, k[14], 23, -35309556);
        a = hh(a, b, c, d, k[1], 4, -1530992060);
        d = hh(d, a, b, c, k[4], 11, 1272893353);
        c = hh(c, d, a, b, k[7], 16, -155497632);
        b = hh(b, c, d, a, k[10], 23, -1094730640);
        a = hh(a, b, c, d, k[13], 4, 681279174);
        d = hh(d, a, b, c, k[0], 11, -358537222);
        c = hh(c, d, a, b, k[3], 16, -722521979);
        b = hh(b, c, d, a, k[6], 23, 76029189);
        a = hh(a, b, c, d, k[9], 4, -640364487);
        d = hh(d, a, b, c, k[12], 11, -421815835);
        c = hh(c, d, a, b, k[15], 16, 530742520);
        b = hh(b, c, d, a, k[2], 23, -995338651);

        a = ii(a, b, c, d, k[0], 6, -198630844);
        d = ii(d, a, b, c, k[7], 10, 1126891415);
        c = ii(c, d, a, b, k[14], 15, -1416354905);
        b = ii(b, c, d, a, k[5], 21, -57434055);
        a = ii(a, b, c, d, k[12], 6, 1700485571);
        d = ii(d, a, b, c, k[3], 10, -1894986606);
        c = ii(c, d, a, b, k[10], 15, -1051523);
        b = ii(b, c, d, a, k[1], 21, -2054922799);
        a = ii(a, b, c, d, k[8], 6, 1873313359);
        d = ii(d, a, b, c, k[15], 10, -30611744);
        c = ii(c, d, a, b, k[6], 15, -1560198380);
        b = ii(b, c, d, a, k[13], 21, 1309151649);
        a = ii(a, b, c, d, k[4], 6, -145523070);
        d = ii(d, a, b, c, k[11], 10, -1120210379);
        c = ii(c, d, a, b, k[2], 15, 718787259);
        b = ii(b, c, d, a, k[9], 21, -343485551);

        x[0] = add32(a, x[0]);
        x[1] = add32(b, x[1]);
        x[2] = add32(c, x[2]);
        x[3] = add32(d, x[3]);
    },

    /* there needs to be support for Unicode here,
       * unless we pretend that we can redefine the MD-5
       * algorithm for multi-byte characters (perhaps
       * by adding every four 16-bit characters and
       * shortening the sum to 32 bits). Otherwise
       * I suggest performing MD-5 as if every character
       * was two bytes--e.g., 0040 0025 = @%--but then
       * how will an ordinary MD-5 sum be matched?
       * There is no way to standardize text to something
       * like UTF-8 before transformation; speed cost is
       * utterly prohibitive. The JavaScript standard
       * itself needs to look at this: it should start
       * providing access to strings as preformed UTF-8
       * 8-bit unsigned value arrays.
       */
    md5blk = function (s) {
        var md5blks = [],
            i; /* Andy King said do it this way. */

        for (i = 0; i < 64; i += 4) {
            md5blks[i >> 2] = s.charCodeAt(i) + (s.charCodeAt(i + 1) << 8) + (s.charCodeAt(i + 2) << 16) + (s.charCodeAt(i + 3) << 24);
        }
        return md5blks;
    },

    md5blk_array = function (a) {
        var md5blks = [],
            i; /* Andy King said do it this way. */

        for (i = 0; i < 64; i += 4) {
            md5blks[i >> 2] = a[i] + (a[i + 1] << 8) + (a[i + 2] << 16) + (a[i + 3] << 24);
        }
        return md5blks;
    },

    md51 = function (s) {
        var n = s.length,
            state = [1732584193, -271733879, -1732584194, 271733878],
            i,
            length,
            tail,
            tmp,
            lo,
            hi;

        for (i = 64; i <= n; i += 64) {
            md5cycle(state, md5blk(s.substring(i - 64, i)));
        }
        s = s.substring(i - 64);
        length = s.length;
        tail = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
        for (i = 0; i < length; i += 1) {
            tail[i >> 2] |= s.charCodeAt(i) << ((i % 4) << 3);
        }
        tail[i >> 2] |= 0x80 << ((i % 4) << 3);
        if (i > 55) {
            md5cycle(state, tail);
            for (i = 0; i < 16; i += 1) {
                tail[i] = 0;
            }
        }

        // Beware that the final length might not fit in 32 bits so we take care of that
        tmp = n * 8;
        tmp = tmp.toString(16).match(/(.*?)(.{0,8})$/);
        lo = parseInt(tmp[2], 16);
        hi = parseInt(tmp[1], 16) || 0;

        tail[14] = lo;
        tail[15] = hi;

        md5cycle(state, tail);
        return state;
    },

    md51_array = function (a) {
        var n = a.length,
            state = [1732584193, -271733879, -1732584194, 271733878],
            i,
            length,
            tail,
            tmp,
            lo,
            hi;

        for (i = 64; i <= n; i += 64) {
            md5cycle(state, md5blk_array(a.subarray(i - 64, i)));
        }

        // Not sure if it is a bug, however IE10 will always produce a sub array of length 1
        // containing the last element of the parent array if the sub array specified starts
        // beyond the length of the parent array - weird.
        // https://connect.microsoft.com/IE/feedback/details/771452/typed-array-subarray-issue
        a = (i - 64) < n ? a.subarray(i - 64) : new Uint8Array(0);

        length = a.length;
        tail = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
        for (i = 0; i < length; i += 1) {
            tail[i >> 2] |= a[i] << ((i % 4) << 3);
        }

        tail[i >> 2] |= 0x80 << ((i % 4) << 3);
        if (i > 55) {
            md5cycle(state, tail);
            for (i = 0; i < 16; i += 1) {
                tail[i] = 0;
            }
        }

        // Beware that the final length might not fit in 32 bits so we take care of that
        tmp = n * 8;
        tmp = tmp.toString(16).match(/(.*?)(.{0,8})$/);
        lo = parseInt(tmp[2], 16);
        hi = parseInt(tmp[1], 16) || 0;

        tail[14] = lo;
        tail[15] = hi;

        md5cycle(state, tail);

        return state;
    },

    hex_chr = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'],

    rhex = function (n) {
        var s = '',
            j;
        for (j = 0; j < 4; j += 1) {
            s += hex_chr[(n >> (j * 8 + 4)) & 0x0F] + hex_chr[(n >> (j * 8)) & 0x0F];
        }
        return s;
    },

    hex = function (x) {
        var i;
        for (i = 0; i < x.length; i += 1) {
            x[i] = rhex(x[i]);
        }
        return x.join('');
    },

    md5 = function (s) {
        return hex(md51(s));
    },



    ////////////////////////////////////////////////////////////////////////////

    /**
     * SparkMD5 OOP implementation.
     *
     * Use this class to perform an incremental md5, otherwise use the
     * static methods instead.
     */
    SparkMD5 = function () {
        // call reset to init the instance
        this.reset();
    };


    // In some cases the fast add32 function cannot be used..
    if (md5('hello') !== '5d41402abc4b2a76b9719d911017c592') {
        add32 = function (x, y) {
            var lsw = (x & 0xFFFF) + (y & 0xFFFF),
                msw = (x >> 16) + (y >> 16) + (lsw >> 16);
            return (msw << 16) | (lsw & 0xFFFF);
        };
    }


    /**
     * Appends a string.
     * A conversion will be applied if an utf8 string is detected.
     *
     * @param {String} str The string to be appended
     *
     * @return {SparkMD5} The instance itself
     */
    SparkMD5.prototype.append = function (str) {
        // converts the string to utf8 bytes if necessary
        if (/[\u0080-\uFFFF]/.test(str)) {
            str = unescape(encodeURIComponent(str));
        }

        // then append as binary
        this.appendBinary(str);

        return this;
    };

    /**
     * Appends a binary string.
     *
     * @param {String} contents The binary string to be appended
     *
     * @return {SparkMD5} The instance itself
     */
    SparkMD5.prototype.appendBinary = function (contents) {
        this._buff += contents;
        this._length += contents.length;

        var length = this._buff.length,
            i;

        for (i = 64; i <= length; i += 64) {
            md5cycle(this._state, md5blk(this._buff.substring(i - 64, i)));
        }

        this._buff = this._buff.substr(i - 64);

        return this;
    };

    /**
     * Finishes the incremental computation, reseting the internal state and
     * returning the result.
     * Use the raw parameter to obtain the raw result instead of the hex one.
     *
     * @param {Boolean} raw True to get the raw result, false to get the hex result
     *
     * @return {String|Array} The result
     */
    SparkMD5.prototype.end = function (raw) {
        var buff = this._buff,
            length = buff.length,
            i,
            tail = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
            ret;

        for (i = 0; i < length; i += 1) {
            tail[i >> 2] |= buff.charCodeAt(i) << ((i % 4) << 3);
        }

        this._finish(tail, length);
        ret = !!raw ? this._state : hex(this._state);

        this.reset();

        return ret;
    };

    /**
     * Finish the final calculation based on the tail.
     *
     * @param {Array}  tail   The tail (will be modified)
     * @param {Number} length The length of the remaining buffer
     */
    SparkMD5.prototype._finish = function (tail, length) {
        var i = length,
            tmp,
            lo,
            hi;

        tail[i >> 2] |= 0x80 << ((i % 4) << 3);
        if (i > 55) {
            md5cycle(this._state, tail);
            for (i = 0; i < 16; i += 1) {
                tail[i] = 0;
            }
        }

        // Do the final computation based on the tail and length
        // Beware that the final length may not fit in 32 bits so we take care of that
        tmp = this._length * 8;
        tmp = tmp.toString(16).match(/(.*?)(.{0,8})$/);
        lo = parseInt(tmp[2], 16);
        hi = parseInt(tmp[1], 16) || 0;

        tail[14] = lo;
        tail[15] = hi;
        md5cycle(this._state, tail);
    };

    /**
     * Resets the internal state of the computation.
     *
     * @return {SparkMD5} The instance itself
     */
    SparkMD5.prototype.reset = function () {
        this._buff = "";
        this._length = 0;
        this._state = [1732584193, -271733879, -1732584194, 271733878];

        return this;
    };

    /**
     * Releases memory used by the incremental buffer and other aditional
     * resources. If you plan to use the instance again, use reset instead.
     */
    SparkMD5.prototype.destroy = function () {
        delete this._state;
        delete this._buff;
        delete this._length;
    };


    /**
     * Performs the md5 hash on a string.
     * A conversion will be applied if utf8 string is detected.
     *
     * @param {String}  str The string
     * @param {Boolean} raw True to get the raw result, false to get the hex result
     *
     * @return {String|Array} The result
     */
    SparkMD5.hash = function (str, raw) {
        // converts the string to utf8 bytes if necessary
        if (/[\u0080-\uFFFF]/.test(str)) {
            str = unescape(encodeURIComponent(str));
        }

        var hash = md51(str);

        return !!raw ? hash : hex(hash);
    };

    /**
     * Performs the md5 hash on a binary string.
     *
     * @param {String}  content The binary string
     * @param {Boolean} raw     True to get the raw result, false to get the hex result
     *
     * @return {String|Array} The result
     */
    SparkMD5.hashBinary = function (content, raw) {
        var hash = md51(content);

        return !!raw ? hash : hex(hash);
    };

    /**
     * SparkMD5 OOP implementation for array buffers.
     *
     * Use this class to perform an incremental md5 ONLY for array buffers.
     */
    SparkMD5.ArrayBuffer = function () {
        // call reset to init the instance
        this.reset();
    };

    ////////////////////////////////////////////////////////////////////////////

    /**
     * Appends an array buffer.
     *
     * @param {ArrayBuffer} arr The array to be appended
     *
     * @return {SparkMD5.ArrayBuffer} The instance itself
     */
    SparkMD5.ArrayBuffer.prototype.append = function (arr) {
        // TODO: we could avoid the concatenation here but the algorithm would be more complex
        //       if you find yourself needing extra performance, please make a PR.
        var buff = this._concatArrayBuffer(this._buff, arr),
            length = buff.length,
            i;

        this._length += arr.byteLength;

        for (i = 64; i <= length; i += 64) {
            md5cycle(this._state, md5blk_array(buff.subarray(i - 64, i)));
        }

        // Avoids IE10 weirdness (documented above)
        this._buff = (i - 64) < length ? buff.subarray(i - 64) : new Uint8Array(0);

        return this;
    };

    /**
     * Finishes the incremental computation, reseting the internal state and
     * returning the result.
     * Use the raw parameter to obtain the raw result instead of the hex one.
     *
     * @param {Boolean} raw True to get the raw result, false to get the hex result
     *
     * @return {String|Array} The result
     */
    SparkMD5.ArrayBuffer.prototype.end = function (raw) {
        var buff = this._buff,
            length = buff.length,
            tail = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
            i,
            ret;

        for (i = 0; i < length; i += 1) {
            tail[i >> 2] |= buff[i] << ((i % 4) << 3);
        }

        this._finish(tail, length);
        ret = !!raw ? this._state : hex(this._state);

        this.reset();

        return ret;
    };

    SparkMD5.ArrayBuffer.prototype._finish = SparkMD5.prototype._finish;

    /**
     * Resets the internal state of the computation.
     *
     * @return {SparkMD5.ArrayBuffer} The instance itself
     */
    SparkMD5.ArrayBuffer.prototype.reset = function () {
        this._buff = new Uint8Array(0);
        this._length = 0;
        this._state = [1732584193, -271733879, -1732584194, 271733878];

        return this;
    };

    /**
     * Releases memory used by the incremental buffer and other aditional
     * resources. If you plan to use the instance again, use reset instead.
     */
    SparkMD5.ArrayBuffer.prototype.destroy = SparkMD5.prototype.destroy;

    /**
     * Concats two array buffers, returning a new one.
     *
     * @param  {ArrayBuffer} first  The first array buffer
     * @param  {ArrayBuffer} second The second array buffer
     *
     * @return {ArrayBuffer} The new array buffer
     */
    SparkMD5.ArrayBuffer.prototype._concatArrayBuffer = function (first, second) {
        var firstLength = first.length,
            result = new Uint8Array(firstLength + second.byteLength);

        result.set(first);
        result.set(new Uint8Array(second), firstLength);

        return result;
    };

    /**
     * Performs the md5 hash on an array buffer.
     *
     * @param {ArrayBuffer} arr The array buffer
     * @param {Boolean}     raw True to get the raw result, false to get the hex result
     *
     * @return {String|Array} The result
     */
    SparkMD5.ArrayBuffer.hash = function (arr, raw) {
        var hash = md51_array(new Uint8Array(arr));

        return !!raw ? hash : hex(hash);
    };

    return SparkMD5;
}));

    </script>
  </head>
  <body>
    <div id="app" style="height:100%">
    	<router-view></router-view>
    </div>
  </body>
</html>
